AutoHotKey问题与Alt Tab快捷键有关 [英] AutoHotKey issue with Alt Tab shortcut

查看:518
本文介绍了AutoHotKey问题与Alt Tab快捷键有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用AHK创建一个简单的脚本,以使用以下代码在窗口之间切换(类似于三星手机上的最近"按钮):

i was trying to create a simple script with AHK to switch between windows (similar to the "recent" button on a samsung mobile) with this code:

XButton2::
Send, {Alt down}{Tab}
Return

问题是当我按下Enter键或单击鼠标左键时,我不知道如何使脚本释放Alt键. 有什么帮助吗?

the problem is that i don't know how to make the script to release the Alt key when i strike Enter or click the Left mouse button. Any help please?

推荐答案

XButton2:: 
    AltTabMenu := true  ; assign the Boolean value "true" or "1" to this variable
    Send, {Alt down}{Tab}
return

; The #If directive creates context-sensitive hotkeys:

#If (AltTabMenu) ; If this variable has the value "true" 

    ; The * prefix fires the hotkey even if extra modifiers (in this case Alt) are being held down

    *Enter::
    *MButton::
        Send {Enter}
        Send {Blind}{Alt Up} ; release Alt
        MouseCenterInActiveWindow()
        AltTabMenu := false
    return

    ~*LButton::
        Click
        Send {Blind}{Alt Up} ; release Alt
        MouseCenterInActiveWindow()
        AltTabMenu := false
    return      

    ; menu navigation by scrolling the mouse wheel:

    *WheelUp:: Send {Right} 
    *WheelDown:: Send {Left}

#If ; turn off context sensitivity

MouseCenterInActiveWindow(){
    WinGetPos,,Y, Width, Height, A ; get active window size
    Xcenter := Width/2        ; calculate center of active window
    Ycenter := Height/2 
    MouseMove, Xcenter, Ycenter, 0
}

这篇关于AutoHotKey问题与Alt Tab快捷键有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆