Are any actions occuring outside the loop after the soundplay? If you just want to soundplay, then it's fine as is. But if you have other code that you are executing when the image is found, make sure your SoundPlay is set to asynchronous. (Add ,1
after the sound file I believe.)
The point of MsgBox was just to test that AHK is responding speedily to finding the image.
Quick GUI; I suggest you play around with GUI in a separate script to get what you want.
Code: Select all
Gui, Add, Text,,Overlay
Gui, +AlwaysOnTop +E0x20 +LastFound
WinSet, Transparent, 255
Gui, Show, NA, OverlayTitle
I learned something new whipping this up for you. I've suggested using +E0x20 for years, but didn't realize (or since forgotten) that you need to make the window transparent for it to work. I did find that a minimum transparency of 255 (the highest numerical value; if it was set to 0, the window would be invisible, so a 255 makes it opaque) is necessary to make it work as a click-through. But you may still want to have it partially transparent, otherwise you wouldn't necessarily know what you're clicking on.
Close the overlay by right clicking on the window icon in the taskbar and selecting close. Otherwise, exit your script, or reload it if you tie the overlay to a hotkey.