Skip to content

Instantly share code, notes, and snippets.

@umar14
Created August 14, 2019 05:40
Show Gist options
  • Save umar14/18efbeddf3813923a0eb448ab6e93bda to your computer and use it in GitHub Desktop.
Save umar14/18efbeddf3813923a0eb448ab6e93bda to your computer and use it in GitHub Desktop.
A simple Autoit Script for Windows
#include <Misc.au3>
#include <MsgBoxConstants.au3>
Local $hDLL = DllOpen("user32.dll")
While 1
If _IsPressed("75", $hDLL) Then
ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
; Wait until key is released.
While _IsPressed("75", $hDLL)
Sleep(100)
WEnd
ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
Send("!v") ;Send ALT+v
Send("{ASC 065}") ;Send the ASCII value A
Sleep(100) ;Wait 100ms
Send("{TAB}") ;Send TAB
Send("^c") ;Send Ctrl+c to Copy
Send("{ESC}") ;Send ESC
ElseIf _IsPressed("1B", $hDLL) Then
MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
ExitLoop
EndIf
Sleep(250)
WEnd
DllClose($hDLL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment