首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动热键多开关箱

自动热键多开关箱
EN

Stack Overflow用户
提问于 2022-04-11 12:35:40
回答 1查看 142关注 0票数 0

如何制作不同的检查开关。在这段代码中,我想让开关立即检查wintitle变量和winclass变量,查看行开关(wintitle _维斯温类)--这是一个示例:

代码语言:javascript
复制
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)请解释一下它是如何工作的

EN

回答 1

Stack Overflow用户

发布于 2022-04-15 19:47:36

开关只用于检查单个值,不能同时检查其中的两个值。对于更复杂的事情,您需要使用if语句:

代码语言:javascript
复制
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
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71827948

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档