Last active
April 28, 2019 17:22
-
-
Save diogotito/192e952b1d2c5aa12ee886507b4f8c76 to your computer and use it in GitHub Desktop.
An AutoHotKey script to bind F8 to a click in the "Stop Thymio" button in Aseba Studio.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. | |
#SingleInstance force | |
#If WinActive("ahk_exe " "asebastudio.exe") | |
F8:: | |
WinGetPos, WinX, WinY, WinW, WinH | |
MouseGetPos, x, y | |
; ImageSearch, FoundX, FoundY, %WinX%, %WinY%, WinX+WinW, WinY+WinH, StopThymioTe.png | |
; ImageSearch, FoundX, FoundY, 0, 800, 600, 1000, StopThymioText.png | |
ImageSearch, FoundX, FoundY, %WinX%, %WinY%+600, WinX+600, WinY+WinH, *TransBlack StopThymioBlack.png | |
if (ErrorLevel = 2) { | |
MsgBox "Could not conduct the search" | |
} | |
if (ErrorLevel = 1) { | |
; MsgBox "Icon could not be found on the screen" | |
ImageSearch, PaneX, PaneY, %WinX%, WinY, WinX+100, WinY+WinH, StopThymioOpenedPane.png | |
PaneX += 50 | |
; MsgBox "Opened pane detected at %PaneX%x%PaneY%" | |
ImageSearch, ToolsX, ToolsY, %WinX%, WinY+WinH-100, WinX+100, WinY+WinH, StopThymioLocalTools.png | |
; MsgBox "Local Tools detected at %ToolsX%x%ToolsY%" | |
MouseClick, Left, ToolsX, ToolsY | |
Sleep, 50 | |
ImageSearch, FoundX, FoundY, %WinX%, %WinY%, WinX+WinW, WinY+WinH, *TransBlack StopThymioBlack.png | |
MouseClick, Left, FoundX, FoundY, | |
Sleep, 50 | |
MouseClick, Left, PaneX, PaneY | |
Sleep, 50 | |
} else { | |
MouseGetPos, x, y | |
MouseClick, Left, FoundX, FoundY, | |
Sleep, 50 | |
} | |
MouseMove, %x%, %y% | |
#if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment