Skip to content

Instantly share code, notes, and snippets.

@malpka
Created June 4, 2020 06:05
Show Gist options
  • Save malpka/34a4bd8f6c19b0a079c5766727600c99 to your computer and use it in GitHub Desktop.
Save malpka/34a4bd8f6c19b0a079c5766727600c99 to your computer and use it in GitHub Desktop.
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
; Press Esc to terminate script, Pause/Break to "pause"
Global $g_bPaused = False
Global $m_pos
HotKeySet("{PAUSE}", "HotKeyPressed")
HotKeySet("{ESC}", "HotKeyPressed")
HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d
While 1
Sleep(100)
WEnd
Func HotKeyPressed()
Switch @HotKeyPressed ; The last hotkey pressed.
Case "{PAUSE}" ; String is the {PAUSE} hotkey.
$m_pos = MouseGetPos()
$g_bPaused = Not $g_bPaused
While $g_bPaused
MouseClick($MOUSE_CLICK_LEFT)
MouseMove($m_pos[0], $m_pos[1],0)
Sleep(20)
MouseMove($m_pos[0]+470, $m_pos[1],0)
MouseClick($MOUSE_CLICK_LEFT)
Sleep(20)
ToolTip('Script is "Running"', 0, 0)
WEnd
ToolTip("")
Case "{ESC}" ; String is the {ESC} hotkey.
Exit
Case "+!d" ; String is the Shift-Alt-d hotkey.
MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndSwitch
EndFunc ;==>HotKeyPressed
; Double click at the current mouse position.
;MouseClick($MOUSE_CLICK_LEFT)
;MouseClick($MOUSE_CLICK_LEFT)
; Double click at the x, y position of 0, 500.
;MouseClick($MOUSE_CLICK_LEFT, 0, 500, 2)
; Double click at the x, y position of 0, 500. This is a better approach as it takes into account left/right handed users.
;MouseClick($MOUSE_CLICK_PRIMARY, 0, 500, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment