我正在尝试查看是否使用此WinExist
脚本打开了“另存为”框
if WinExist,Save As,Save As
MsgBox, is there
else
MsgBox, is not there
答案 0 :(得分:1)
您的原始代码几乎正确无误:
if
和WinExist
之间的空格。ifWinExist
的第二个参数是WinTitle
。如果“另存为”对话框不包含“另存为”文本,则必须删除该第二个参数。我的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
答案 1 :(得分:0)
假设它是操作系统的窗口,我会做类似的事情,
^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
}
}