如何制作不同的检查开关。在这段代码中,我想让开关立即检查wintitle变量和winclass变量,查看行开关(wintitle _维斯温类)--这是一个示例:
WinGetTitle, wintitle, A
WinGetClass, winclass, A
Switch (wintitle || winclass) ;;<<<<< Look at this row, How to set -
{ ;; - multiple variations for check ??
Case "Calculator": ;;<< This is the %wintitle%
WinActivate, %wintitle%
send 5
send {NumpadAdd}
send 10
Case "ahk_class Notepad++": ;;<<This shoud check %winclass% variable
WinActivate, %winclass%
send I am a bot
Default:
msgbox,,, not found
}或者我应该把它写成&&?如:开关(wintitle && winclass)请解释一下它是如何工作的
发布于 2022-04-15 19:47:36
开关只用于检查单个值,不能同时检查其中的两个值。对于更复杂的事情,您需要使用if语句:
if (wintitle == "Calculator") {
WinActivate, %wintitle%
send 5
send {NumpadAdd}
send 10
} else if (winclass == "ahk_class Notepad++") {
WinActivate, %winclass%
send I am a bot
} else {
msgbox,,, not found
}https://stackoverflow.com/questions/71827948
复制相似问题