using System; using Arp.Prova.PlayLib; //このサンプルコードは、指定したプリンタのプロパティを開くサンプルコードです // CodeClass public class CodeClass { public static int CodeStart() { //Sleep処理の待ち時間(1秒) int basicWait = 1000; //プリンタ名を指定(プリンタ名を変更する場合は、「Microsoft XPS Document Writer」を変更してください。) string printerName = "Microsoft XPS Document Writer"; //「control printers」を実行し「Bluetoothとデバイス」画面を開きます PlayLib.ProcessStart("control", "printers"); //「Bluetoothとデバイス」画面が開くまで待つ(待ち時間60秒) if(PlayLib.WaitWindow("設定", true, 60) == true) { PlayLib.Window("設定").UIGroup("プリンターとスキャナー").Click(); PlayLib.Sleep(basicWait); PlayLib.Window("設定").UIGroup(printerName).Click(); PlayLib.Sleep(basicWait); PlayLib.Window("設定").UIGroup("ハードウェアのプロパティ").Click(); PlayLib.Sleep(basicWait); //指定したプリンタのプロパティ画面が開いているかチェックする(待ち時間60秒) if(PlayLib.CheckWindowExist(printerName + "のプロパティ", true, 60) == false) { //指定したプリンタのプロパティ画面が開いていない場合、ログを出力し処理を終了する PlayLib.TestLogError("指定したプリンタのプロパティが開きませんでした。"); return -1; } } else { //「Bluetoothとデバイス」画面が開かなかった場合、ログを出力し処理を終了する PlayLib.TestLogError("「Bluetoothとデバイス」画面が開きませんでした。"); return -1; } return 0; } }