Autohotkey 使用WinExist中带有空格的应用程序名称

Autohotkey 使用WinExist中带有空格的应用程序名称,autohotkey,Autohotkey,所以我想检查是否存在某个应用程序 如果在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 >

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

如果在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是一个函数,函数参数是表达式

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

您还需要在分号前留出一个空格才能使用注释

#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 

希望对您有所帮助

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

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

您还需要在分号前留出一个空格才能使用注释

#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 

希望对您有所帮助

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

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

您还需要在分号前留出一个空格才能使用注释

#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 

希望对您有所帮助

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

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

您还需要在分号前留出一个空格才能使用注释

#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 

希望有帮助

谢谢,确实有帮助。但是当笔记本电脑盖被关闭时,它没有关闭,但这是另一个问题。如果笔记本电脑盖被关闭,计算机可能会处于待机状态,脚本将无法运行。这是一个笔记本电脑配置问题,您需要更改笔记本电脑的“盖关闭”行为。感谢它的帮助。但是当笔记本电脑盖被关闭时,它没有关闭,但这是另一个问题。如果笔记本电脑盖被关闭,计算机可能会处于待机状态,脚本将无法运行。这是一个笔记本电脑配置问题,您需要更改笔记本电脑的“盖关闭”行为。感谢它的帮助。但是当笔记本电脑盖被关闭时,它没有关闭,但这是另一个问题。如果笔记本电脑盖被关闭,计算机可能会处于待机状态,脚本将无法运行。这是一个笔记本电脑配置问题,您需要更改笔记本电脑的“盖关闭”行为。感谢它的帮助。但是当笔记本电脑盖被关闭时,它没有关闭,但这是另一个问题。如果笔记本电脑盖被关闭,计算机可能会处于待机状态,脚本将无法运行。这是笔记本电脑的配置问题,您需要更改笔记本电脑的“盖关闭”行为。