ウィンドウのステータスバーに指定された文字列が含まれるまで待ちます。
StatusBarWait BarText, Timeout, Part#, WinTitle, WinText, Interval, ExcludeTitle, ExcludeText
型:文字列
If blank or omitted, the function waits for the status bar to become blank. それ以外の場合は、関数が表示されるのを待つテキストまたは部分テキストを指定する。テキストは大文字と小文字を区別し、マッチング動作はSetTitleMatchModeによって決定される。
バーのテキストが変わるのを待つには、ループ内でStatusBarGetTextを使うか、このページの一番下にあるRegExの例を使う。
省略した場合は、無期限に待機します。そうでなければ、指定された秒数以上待機することはありません。1 秒未満の時間で待機するには、浮動小数点数を指定します。たとえば最大 250 ミリ秒待機するときは、 0.25 と指定します。
型:整数
If omitted, it defaults to 1, which is usually the part that contains the text of interest. それ以外の場合は、検索するバーの品番を指定する。
もしこれらの項目が未設定または省略されたときは、最後に見つかったウィンドウが使用されます。そうでないときは、WinTitleに ウィンドウタイトルまたはターゲットウィンドウを識別するための他の基準、および/またはWinTextにターゲットウィンドウの単一のテキスト要素からの部分文字列(付属のWindow Spyユーティリティを使えばわかります)を指定します。
ExcludeTitleとExcludeTextはウィンドウのタイトルまたはテキストで除外するために使用します。指定の仕方はWinTitleとWinTextに似ていますが、ExcludeTitleはウィンドウのタイトル以外の基準(ウィンドウクラスやHWNDなど)を認識しません。
ウィンドウのタイトルとテキストは大文字と小文字を区別します。DetectHiddenWindows関数 と DetectHiddenText関数で変更しない限り、初期設定では非表示ウィンドウは検出されず、非表示テキストは検出されます。SetTitleMatchMode関数で変更しない限り、初期設定ではウィンドウのタイトルはその中のどこかにWinTitleまたはExcludeTitleを含んでいれば一致します。
型:整数
If omitted, it defaults to 50. それ以外の場合は、関数が待機している間にステータス・バーをチェックする頻度を指定する(ミリ秒単位)。
この関数は、マッチが見つかった場合は1(true)を返し、タイムアウトした場合は0(false)を返します。
A TargetError is thrown if the target window could not be found or does not contain a standard status bar.
An OSError is thrown if there was a problem sending the SB_GETPARTS message or no reply was received within 2000 ms, or if memory could not be allocated within the process which owns the status bar.
この関数は、ウィンドウ上の最初の標準ステータスバーを読み込もうとする(Microsoft common control:msctls_statusbar32). プログラムによっては、独自のステータス・バーやMSコモン・コントロールの特別なバージョンを使用するものがあり、その場合はそのようなバーはサポートされない。
通常、ループ内でStatusBarGetTextを使用するよりも、StatusBarGetTextを繰り返し呼び出すことによるオーバーヘッドを回避する最適化を含む StatusBarWait を使用する方が効率的です。
StatusBarWaitは、マッチ待ちを開始する前にターゲット・ウィンドウを決定する。そのターゲットウィンドウが閉じられた場合、指定されたWinTitleと WinTextに一致する別のウィンドウがあっても、関数は待機を停止します。
関数が待機状態にある間、ホットキー、カスタムメニュー項目、またはタイマーによって新しいスレッドを起動することができます。
StatusBarGetText, WinGetTitle, WinGetText, ControlGetText
既存のエクスプローラ/検索ウィンドウに新しい検索パターンを入力します。
if WinExist("Search Results") ; Sets the Last Found window to simplify the below. { WinActivate Send "{tab 2}!o*.txt{enter}" ; In the Search window, enter the pattern to search for. Sleep 400 ; Give the status bar time to change to "Searching". if StatusBarWait("found", 30) MsgBox "The search successfully completed." else MsgBox "The function timed out." }
SetTitleMatchMode "RegEx" ; Accept regular expressions for use below. if WinExist("A") ; Set the last-found window to be the active window (for use below). { OrigText := StatusBarGetText() StatusBarWait "^(?!^\Q" OrigText "\E$)" ; This regular expression waits for any change to the text. }