3

WinExistこのスクリプトで開いている「名前を付けて保存」ボックスがあるかどうかを調べようとしています

if WinExist,Save As,Save As
MsgBox, is there
else
MsgBox, is not there
4

2 に答える 2

4

元のコードはほぼ正しいです:

  • ifとの間のスペースをWinExist削除する必要があります。
  • の 2 番目のパラメーターはifWinExistですWinTitle。[名前を付けて保存] ダイアログに「名前を付けて保存」というテキストが含まれていない場合は、その 2 番目のパラメーターを削除する必要があります。これは、英語 (オーストラリア) の地域設定を使用した Windows 7 システムの場合です。

作業例:

; ifWinExist command
ifWinExist, Save As
    MsgBox, is there
else
    MsgBox, is not there

; if(expression) and WinExist() function
if WinExist("Save As")
    MsgBox, is there
else
    MsgBox, is not there

条件を組み合わせることもできます:

ifWinExist, Save As ahk_class #32770
于 2012-11-04T01:41:53.190 に答える
2

それがOSのウィンドウであると仮定すると、私は次のようにします、

^F1::       ;press Control + F1 to serch the window.
    if FindWindow()
        msgbox Found
    else
        msgbox Not Found
Return

FindWindow(strPartOfTitle="Save", strClass="#32770") {

    if (hWnd := WinExist("ahk_class " . strClass)) 
    {
        WinGetTitle, strWinTitle, ahk_id %hWnd%
        if InStr(strWinTitle, strPartOfTitle) 
            return true
        else
            return false
    } 
}
于 2012-09-04T20:09:18.030 に答える