我有这样的功能:
Seep(toSend){
Send, %toSend%
Sleep, 1000
}
我这样使用它:
Seep("Typing a new line{Enter}")
我想将 Windows 环境变量的值发送到该函数以打印出来,如下所示:
Seep("This is the path: " %PATH% " ok now what?{Enter}")
我对此进行了许多尝试,但均无济于事。通常,它不会为 PATH 打印任何内容,如下所示:
This is the path: ok now what?
这是我尝试过的:
Seep("This is the path: %PATH% ok now what?{Enter}") ; prints literally %PATH%
我试着先把它放在一个变量中:
pathv:=PATH ; also tried %PATH%, $PATH with the same outcome
Seep("This is the path: " pathv " ok now what?{Enter}") ; prints an empty string
我什至把它放在双变量中:
pathv:=PATH
toPrint:="This is the path: " pathv " ok now what?{Enter}"
再一次,一个空字符串。
如果您有
#NoEnv
[1] 指令,则您的脚本环境变量不可用。在这种情况下,您可以使用EnvGet
[2] 命令,例如:[1] https://www.autohotkey.com/docs/commands/_NoEnv.htm
[2] https://www.autohotkey.com/docs/commands/EnvGet.htm