在 WinExist 中使用具有 space(s) 的应用程序名称

Use of application name with space(s) with WinExist

所以我想检查某个应用程序是否存在。

如果是这样并且在 4.5 分钟内没有任何输入,请切换到该应用程序并执行一些任务。

基本上是一个AFK作弊者。

这是我目前拥有的:

#SingleInstance force
#Persistent
settimer, idleCheck, 1000; check every second
return

idleCheck:
if WinExist(App Name with Spaces); if app is running
{
    if(A_TimeIdle >= 270000); and there was no input in 4.5 min
    {
        WinActivate; switch to that app
        sendInput z; and perform an action
    }
}
return 

现在显然那是行不通的,否则我不会在这里发帖。

问题很简单,但我找不到答案。

提前致谢。

WinExist 是一个函数,函数参数是表达式...

在表达式中,您需要在字符串周围使用双引号 ",而您不需要 % 在变量周围

你还需要在分号前加一个space才能使用注释

#SingleInstance force
#Persistent
settimer, idleCheck, 1000 ; check every second
return

idleCheck:
if WinExist("App Name with or without Spaces") ; if app is running
{
    if(A_TimeIdle >= 270000) ; and there was no input in 4.5 min
    {
        WinActivate ; switch to that app
        sendInput z ; and perform an action
    }
}
return 

希望对您有所帮助