I am so excited I got my script to work but I'm totally flummoxed as to why. This is the intention: search for a cute little image. If found, Double-click. If not found, search for the highlighted version of the cute little image – same thing, lighter colors. If found, double-click. Note that I am using the awesome Findclick library (see here https://www.autohotkey.com/boards/viewtopic.php?f=6&t=18719&p=320713#p320713 ) Because it makes image searching a snap.
This is the code:
Code: Select all
Mbutton::
FindClick("autohotkey_travel", "Sleep50 oTransBlack,40 n2") ; Search for the image named autohotkey_travel, click it twice with 50 ms sleeps in between the clicks.
if ErrorLevel=0 ; Now, this line and the next make it so the cute image still gets clicked if it's highlighted. The highlighted state makes the image a couple shades lighter. Autohotkey_travel_light is the highlighted variant of the same picture. I just created
{
FindClick("autohotkey_travel_light", "Sleep50 oTransBlack,40 n2")
}
(Don't get me wrong – I'm glad autohotkey_travel_light gets clicked on when the error level is zero, but it makes me curious.)
I feel like I'm talking around in circles. To keep it simple, what is the script doing when I use Errorlevel = 0? What is the script doing when I set the error level to 1?
Thank you.