我试图找出是否有一个“另存为”框打开这个WinExist
脚本
if WinExist,Save As,Save As
MsgBox, is there
else
MsgBox, is not there
我试图找出是否有一个“另存为”框打开这个WinExist
脚本
if WinExist,Save As,Save As
MsgBox, is there
else
MsgBox, is not there
您的原始代码几乎是正确的:
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
假设它是一个操作系统的窗口,我会做类似的事情,
^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
}
}