Skip to content

Instantly share code, notes, and snippets.

@TLMcode
Created November 9, 2018 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TLMcode/973c71077b906cc0c871413232a18e43 to your computer and use it in GitHub Desktop.
Save TLMcode/973c71077b906cc0c871413232a18e43 to your computer and use it in GitHub Desktop.
xPosArr := [] ; mouse `X position` array
charArr := { right : "H", left : "K" } ; `send keys` array
left := false, right := false ; initializers
speed := 100 ; speed for accuracy
CoordMode, Mouse, Screen
Loop
{
; get mouse cursor position
MouseGetPos, mPosX, mPosY, mPosWin, mPosControl, 1
xPosArr[ mod( a_index-1, 2 )+1 ] := mPosX ; 2 step position array
; conditional statements
if ( a_index > 1 ) ; delay right trigger
{
if ( mPosX < xPosArr[ 2 ] && !left )
{
left := true, right := false, char := charArr.left
}
else if ( mPosX < xPosArr[ 2 ] && left )
{
right := false, char := ""
}
else if ( mPosX > xPosArr[ 2 ] && !right )
{
right := true, left := false, char := charArr.right
}
else if ( mPosX > xPosArr[ 2 ] && right )
{
left := false, char := ""
}
}
; send and speed commands
send % char
sleep % speed
}
ESC::ExitApp ; press escape to exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment