DetectHiddenWindows,Off
这个句子日常得加上,我这几天在给ra写插件的时候发现一些窗口相关的命令死活没有办法激活,浪费n小时排查之后发现问题出在这里
Turning on DetectHiddenWindows can make scripting harder in some cases since some hidden system windows might accidentally match the title or text of another window you’re trying to work with. So most scripts should leave this setting turned off. However, turning it on may be useful if you wish to work with hidden windows directly without first using WinShow to unhide them.
All windowing commands, built-in functions and control flow statements except WinShow are affected by this setting, including WinActivate, WinActive(), IfWinActive, WinWait, WinExist(), IfWinExist. By contrast, WinShow will always unhide a hidden window even if hidden windows are not being detected.
引用一下帮助,这个玩意会让脚本激活一些隐藏的进程
举个例子
if WinExist(“ahk_exe WeChat.exe“)
WinActivate
MsgBox,ok
这个在正常的脚本中运行是没有问题的,但是在注册ra的插件的时候可能环境发生了变化,这个开关被打开了,就导致窗口相关的执行的有问题
另外经老哥指点如果这个关闭的话会无法获取一些进程,只要在获取之前打开,获取之后关闭就可以了
比如这样
所以脚本正常开头就把他关掉就稳了
你想表达什么?写日记?