条件に一致するウィンドウが存在するかどうかで分岐
IfWinExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]
IfWinNotExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]
hwnd:=WinExist("WinTitle", "WinText", "ExcludeTitle", "ExcludeText")
| 引数名 | 説明 |
|---|---|
| WinTitle | ウィンドウタイトルなど。 ウィンドウ指定の方法参照。 |
| WinText | ウィンドウに含まれるテキスト |
| ExcludeTitle | 除外タイトル |
| ExcludeText | 除外テキスト |
IfWinExistが真だったときやIfWinNotExistが偽だったとき、条件に一致したウィンドウはLastFoundWindowとして記憶される。
詳しくはウィンドウ指定の方法参照。
組み込み関数WinExist()は見つかったウィンドウのウィンドウハンドルを返す。
SetTitleMatchMode, DetectHiddenWindows, Last Found Window, IfWinExist, WinActivate, WinWaitActive, WinWait, WinWaitClose
IfWinExist, Untitled - Notepad
{
WinActivate ; Automatically uses the window found above.
WinMaximize ; same
Send, Some text.{Enter}
return
}
IfWinNotExist, Calculator
return
else
{
WinActivate ; The above "IfWinNotExist" also set the "last found" window for us.
WinMove, 40, 40 ; Move it to a new position.
return
}