Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- suppressed:=0
- mhc_active:=1
- mstill:=0
- mWait:=200
- is_stopped:=1
- CoordMode, Mouse, Screen ; by default mouse coords are relative to window, but we want screen coords
- MouseGetPos, Ox, Oy
- ; letter keys suppress mouseclick timer
- Loop 25 {
- Hotkey, % "~" Chr(A_Index+96),Do_Suppress ; loop creating hotkeys for a-y
- }
- gosub Mouse_Check
- return ; end auto execute
- ~z:: ; cancel current timer (there will be no click at this position)
- global Ox
- global Oy
- MouseGetPos, Ox, Oy
- global is_stopped
- is_stopped:=1
- global mstill
- mstill:=0
- Do_Suppress:
- global mstill
- mstill:=0
- return
- #v:: ; windowskey + v to toggle
- global mhc_active
- mhc_active:= mhc_active - 1
- mhc_active:= mhc_active* (-1)
- On_Mouse_Stopped:
- MouseClick
- return
- !Esc:: ; Alt + Esc to quit
- ExitApp
- Mouse_Check:
- global mhc_active
- global suppressed
- global mstill
- global is_stopped
- global Ox
- global Oy
- MouseGetPos, Ox, Oy
- Sleep %mWait%
- loop {
- MouseGetPos, Mx, My
- if( !winactive("ahk_class TaskSwitcherWnd") && !GetKeyState("LButton") && !GetKeyState("MButton")) {
- if( Mx = Ox && My = Oy ) {
- mStill++
- if( mStill >= 5 ) { ; 5 = 1000/mWait
- mStill:=0
- if( !is_stopped && mhc_active) {
- is_stopped:=1
- SetTimer, On_Mouse_Stopped, -1z
- }
- }
- } else {
- is_stopped:=0
- mstill:=0
- }
- Ox:=Mx, Oy:=My
- }
- Sleep %mWait%
- }
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement