Quick Switch Virtual Desktop[AutoHotkey]

Quick Switch Virtual Desktop[AutoHotkey]

Update

/* Library:
 *      Quick Switch Virtual Desktop
 * Description:
 *      在屏幕四周,任务栏,桌面上使用鼠标滚轮来切换虚拟桌面。
 * Warnning:
 *      None.
 * Version:
 *      v1.0.4
 * Author:
 *      泠音
 */

#MaxHotkeysPerInterval 300
WheelUp::
    If (isHook()){
        Send, {LWinDown}{CtrlDown}{Left Down}{LWinUp}{CtrlUp}{Left Up}
    }else{
        MouseClick, WheelUp
    }
    return

WheelDown::
    If (isHook()){
        Send, {LWinDown}{CtrlDown}{Right Down}{LWinUp}{CtrlUp}{Right Up}
    }else{
        MouseClick, WheelDown
    }
    return

isHook(){
    CoordMode, Mouse,Screen
    MouseGetPos, X,Y,ID,CLASS
    ; t1 := A_ScreenWidth-X
    ; t2 := A_ScreenHeight-Y
    ; MsgBox X:%X% Y:%Y% dw:%t1% dh:%t2% W:%A_ScreenWidth% H:%A_ScreenHeight%
    return MouseIsOver("ahk_class WorkerW") 
        or MouseIsOver("ahk_class Shell_TrayWnd") 
        or X==0 
        or Y==0
        or A_ScreenWidth-X<2
        or A_ScreenHeight-Y<2
        or CLASS=="SysListView321"
        or CLASS=="SHELLDLL_DefView1"
}

MouseIsOver(WinTitle) {
    MouseGetPos,,, Win
    return WinExist(WinTitle . " ahk_id " . Win)
}

你可能感兴趣的:(autohotkey)