【发布时间】:2015-06-15 07:46:18
【问题描述】:
这就是我所在的位置:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 3
Loop { ; apparently a loop is recommended for app-as-a-trigger.
Send, ^!a
WinGet, p_exe, ProcessName, Forged Alliance, Style, Style, A {
if(Style & 0xC40000) {
WinSet, Style, -0xC40000, A
WinMaximize, A
}
Sleep, 100
}
}
return
显然我正在努力做到这一点,以便当 ForgedAlliance.exe 运行时,它的窗口边框被删除并最大化。
我有一个由热键触发的工作脚本:
LWin & f::
WinGet Style, Style, A
if(Style & 0xC40000) {
WinSet, Style, -0xC40000, A
WinMaximize, A
} else {
WinSet, Style, +0xC40000, A
WinRestore, A
}
return
现在我希望它由运行的应用程序触发。
我试过了:
If ProcessExist("ForgedAlliance.exe") {
}
return
但这不起作用,即使 FA 没有针对鼠标悬停的任何目标运行,此条件始终返回 true(始终执行代码)。
解决这个问题的正确方法是什么?
【问题讨论】:
-
ProcessExist函数的代码在哪里? -
在脚本中放置无限循环并不是计时器的理想替代品。请看我的回答。
-
@ElliotDeNolf 与上述函数循环中的代码相同。这和 fischgeek 的建议在应用程序开始运行和之后的任何应用程序、窗口或菜单上都是有效的。这当然不是我想要的。我只想定位与 exe 名称或窗口名称匹配的应用程序,没有其他。
标签: autohotkey