AutoHotKey 脚本来设置变量的条件?
AutoHotKey scripting to set condition on variable?
我是 AutoHotKey 脚本的新手,我需要一些帮助来在我的任何热字串之前为变量创建条件。
例如如果机器的A_UserName = A 那么variable1=chris,如果A_UserName=b 然后 variable1=mike,依此类推。
我想将它设置在我的任何热字串之前。这是我的代码示例。
if (A_UserName==A) {
variable1=Chris
}
else {
variable1=Mike
}
:#ct::
send, Closing ticket, please review data and let us know if you have any
questions.Thanks %variable1%
return
关键是我想在我的任何热键或热字串之前设置条件,这样我就不必在所有 hotstrings/hotketys 上使用 if else 语句。
非常感谢任何帮助。
if (A_UserName==A)
表示A
是一个变量名。
在你的情况下,你想要使用
if (A_UserName=="A")
或
if A_UserName = A
或
A := "A"
; or: A = A
if (A_UserName==A)
PS。在使用 ==
时,还要注意 documentation 的以下部分:
The operators != and <> are identical in function. The == operator behaves identically to = except when either of the inputs is not a number, in which case == is always case sensitive and = is always case insensitive (the method of insensitivity depends on StringCaseSense). By contrast, <> and != obey StringCaseSense. Note: A quoted literal string such as "55" is always considered non-numeric in this context.
我是 AutoHotKey 脚本的新手,我需要一些帮助来在我的任何热字串之前为变量创建条件。
例如如果机器的A_UserName = A 那么variable1=chris,如果A_UserName=b 然后 variable1=mike,依此类推。
我想将它设置在我的任何热字串之前。这是我的代码示例。
if (A_UserName==A) {
variable1=Chris
}
else {
variable1=Mike
}
:#ct::
send, Closing ticket, please review data and let us know if you have any
questions.Thanks %variable1%
return
关键是我想在我的任何热键或热字串之前设置条件,这样我就不必在所有 hotstrings/hotketys 上使用 if else 语句。
非常感谢任何帮助。
if (A_UserName==A)
表示A
是一个变量名。
在你的情况下,你想要使用
if (A_UserName=="A")
或
if A_UserName = A
或
A := "A"
; or: A = A
if (A_UserName==A)
PS。在使用 ==
时,还要注意 documentation 的以下部分:
The operators != and <> are identical in function. The == operator behaves identically to = except when either of the inputs is not a number, in which case == is always case sensitive and = is always case insensitive (the method of insensitivity depends on StringCaseSense). By contrast, <> and != obey StringCaseSense. Note: A quoted literal string such as "55" is always considered non-numeric in this context.