AutoHotKey scripting to set condition on variable?
我是AutoHotKey脚本的新手,在我的任何热字符串之前,我都需要一些帮助以在变量上创建条件。
例如,如果计算机的A_UserName = A,则变量1 = chris,如果A_UserName = b,则variable1 = mike,依此类推。
我想在设置任何热键之前设置它。这是我的代码示例。
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 |
关键是我想在任何热键或热字符串之前设置条件,因此我不必在所有热字符串/ hotketys上使用if else语句。
非常感谢您的帮助。
根据您的情况,您想使用
1 | if (A_UserName=="A") |
或
1 | if A_UserName = A |
或
1 2 3 | A :="A" ; or: A = A if (A_UserName==A) |
PS。关于
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.