using System; using System.Drawing; using Arp.Prova.ImageLibrary; using Arp.Prova.CsvLib; using Arp.Prova.PlayLib; //このサンプルは、「Microsoft Edge」に特定のサイトをお気に入りに追加します // CodeClass public class CodeClass { public static int CodeStart() { //ブックマークに追加するURL string bookmarkURL = "https://www.setrobo.jp/"; /************************ここから設定の変更を行います************************/ //■ 「Microsoft Edge」を表示 PlayLib.ProcessStart("msedge.exe"); //■「Microsoft Edge」画面が開くまで待つ if(PlayLib.WaitWindow("*Microsoft? Edge*", true, 60) == true) { //操作しやすいよう設定画面を最大化する if(PlayLib.Window("*Microsoft? Edge*").WaitUIControl("UIButton", "最大化", true, 10)) { PlayLib.Window("*Microsoft? Edge*").UIButton("最大化").Click(); PlayLib.Sleep(1000); } //アドレスバーに入力されている文字列を「Ctrl+A+Delete」で削除 // ※もし「UIEdit&1」で動かない場合、2→3と数値を変更しご確認ください。 PlayLib.Window("*Microsoft? Edge*").UIEdit("UIEdit&1").Input("{Ctrl_Down}A{Ctrl_Up}{Del}"); PlayLib.Sleep(1000); //アドレスバーにブックマークに追加するURLを入力しEnterで起動 PlayLib.Window("*Microsoft? Edge*").UIEdit("UIEdit&1").Input(bookmarkURL + "{Enter}"); PlayLib.Sleep(1000); for(int i = 1; i < 30; i++) { //「このページをお気に入りに追加 (Ctrl+D)」ボタンがあるか確認(☆マーク) PlayLib.TestLog(PlayLib.Window("*Microsoft? Edge").UIButton("*&" + i).Text); if(PlayLib.Window("*Microsoft? Edge").UIButton("*&" + i).Text == "このページをお気に入りに追加 (Ctrl+D)") { //「このページをお気に入りに追加 (Ctrl+D)」ボタンをクリック(☆マーク) PlayLib.Window("*Microsoft? Edge").UIButton("*&" + i).Click(); PlayLib.Sleep(1000); //「完了」ボタンをクリック if(PlayLib.WaitWindow("お気に入り*", true, 10) == true) { PlayLib.Window("お気に入り*").UIButton("完了").Click(); PlayLib.Sleep(1000); } break; } //「このページをお気に入りに追加して編集 (Ctrl+D)」ボタンがあるか確認(★マーク) else if (PlayLib.Window("*Microsoft? Edge").UIButton("*&" + i).Text == "このページをお気に入りに追加して編集 (Ctrl+D)") { PlayLib.TestLog("お気に入りに登録されています"); PlayLib.Sleep(1000); break; } } //「Microsoft Edge」画面を閉じる PlayLib.Window("*Microsoft? Edge").Close(); } else { PlayLib.TestLog("「Microsoft Edge」画面が開きませんでした"); return -1; } return 0; } }