IfWinExist / IfWinNotExist

提供: AutoHotkey Wiki
移動: 案内検索

実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 | キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル | レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト

IfWinExist / IfWinNotExist[編集]

条件に一致するウィンドウが存在するかどうかで分岐。

IfWinExist [, WinTitle, WinText,  ExcludeTitle, ExcludeText]
IfWinNotExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]
hwnd := WinExist("WinTitle", "WinText", "ExcludeTitle", "ExcludeText")

Parameters[編集]

引数名 説明
WinTitle ウィンドウタイトルなど。
ウィンドウ指定の方法参照。
WinText ウィンドウに含まれるテキスト
ExcludeTitle 除外タイトル
ExcludeText 除外テキスト

Remarks[編集]

IfWinExistが真だったときやIfWinNotExistが偽だったとき、条件に一致したウィンドウはLastFoundWindowとして記憶される。

組み込み関数WinExist()は見つかったウィンドウのウィンドウハンドルを返す。

Related[編集]

SetTitleMatchMode, DetectHiddenWindows, Last Found Window, WinActivate, WinWaitActive, WinWait, WinWaitClose

Example(s)[編集]

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
}