自动化脚本 AHK

#C::
while(1)
{
    Sleep, 10
    Click
    GetKeyState, state, Shift
    if state = D
        break
}
#C::
MouseGetPos, mousex,mousey,windowhandle,controlhandle,2
WinGetTitle,title,ahk_id, %windowhandle%
while(1)
{
    ControlClick, x%mousex% y%mousey%, ahk_id %windowhandle%
    ToolTip, %title%`n x%mousex% y%mousey%
    GetKetState, state ,Shift
    if state == D
        break
}
; 在鼠标处弹出菜单 Win-Z .

;   , 菜单名,    ,菜单项文字,回调函数
Menu, MyMenu, Add, D disk, MenuHandlerD
Menu, MyMenu, Add, E disk, MenuHandlerE
Menu, MyMenu, Add                           ; 分割线

; 创建菜单,将被作为子菜单
Menu, Submenu1, Add, Item1, MenuHandler
Menu, Submenu1, Add, Item2, MenuHandler

; 加入子菜单
Menu, MyMenu, Add, My Submenu, :Submenu1

Menu, MyMenu, Add                           ; Add a separator line below the submenu.
Menu, MyMenu, Add, Item3, MenuHandler       ; Add another menu item beneath the submenu.
return                                      ; End of script's auto-execute section.

;call back
MenuHandler:
MsgBox You selected %A_ThisMenuItem% from the menu %A_ThisMenu%.
return

MenuHandlerD:
Run, explore D:\
return

MenuHandlerE:
Run, explore E:\
return

; hot key
#z::Menu, MyMenu, Show  ; i.e. press the Win-Z hotkey to show the menu.
原文地址:https://www.cnblogs.com/Searchor/p/7410519.html