Dav*_* J. 0 variables if-statement autohotkey global-variables declare
当我在#ifwinactive 之后声明一个全局变量时,会弹出一条错误消息,显示该变量未声明。
我有一个很长的脚本,里面有很多#ifwinactive ahk_exe xxx。在这些代码下面,我想声明一个全局变量。但这不起作用。每当我运行脚本时,它都会警告我未声明全局变量。这是我的脚本的简要介绍。
在脚本的顶部,我有这些环境设置:
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
Run Code Online (Sandbox Code Playgroud)
然后我有许多特定于窗口的热键:
#ifwinactive ahk_exe Explorer.EXE
;some hotkeys
#ifwinactive ahk_exe WINWORD.EXE
;some extra hotkeys
;etc.
Run Code Online (Sandbox Code Playgroud)
在底部,我尝试声明一个全局变量,这就是发生错误的地方:
#ifwinactive
a := 1
^p::
if (a != 1){
a := 1
} else {
a := 0
}
return
#if winactive("- YouTube -") and a != 1
p::msgbox,Yes
#if a = 1 and winactive("- YouTube -")
p::msgbox,no
#if
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
405 次 |
| 最近记录: |