News for hackers. Stuff that matters.
Re:Learning to code vs. learning to automate by freetonik on Sunday December 08, 2019 @03:16PM (#21738013)
Can Auto HotKey recognize images and click on them? For example, a specific button in an app or a web page?

This is one of the features that keeps me with Keyboards maestro, which keeps me from switching away from macOS.

Re:Learning to code vs. learning to automate by nickjj on Sunday December 08, 2019 @04:05PM (#21738310)
I'm not an AHK wizard but to my understanding, the answer is "yes" to almost every "but can it do...?" questions.

In your case, from my limited understanding it would be no problem to identify a specific button in an app and then interact with it because you would be hooking into the app's low level window title / class / handles.

AHK comes with a "spy" tool where you can just move your mouse around and it gives you low level details about every window, and then you can write AHK scripts that interact with those things.

The script would look something like:

    ControlClick, OK, "My Cool App"
That would click the OK button in a window that has a title of "My Cool App". If you Google around for "auto hotkey, click button in app" you'll find a ton of examples.
Re:Learning to code vs. learning to automate by ibly31 on Sunday December 08, 2019 @04:17PM (#21738370)
I have limited experience with Keyboard Maestro but I do have some with AppleScript. It lets you do as you described, get windows, titles, UI elements. However this only works on native apps, you cant, for example, click a button on a webpage with a CSS selector or by scanning pixels of the window, ad far as I know. Can AHK do that? That would be super useful
Re:Learning to code vs. learning to automate by nickjj on Sunday December 08, 2019 @04:44PM (#21738562)
While I've never done it, AHK seems to have an API for being able to interact with DOM elements.

Check the marked answer here: https://stackoverflow.com/questions/49516638/ahk-web-element...

The above answer shows both navigating to a new page that isn't open yet or interacting with an already loaded page based on the title of the tab.

Re:Learning to code vs. learning to automate by vasili111 on Sunday December 08, 2019 @05:30PM (#21738877)
Re:Learning to code vs. learning to automate by dmortin on Sunday December 08, 2019 @04:29PM (#21738458)
Yes, Autohotkey can search for pixels and stuff:

https://www.autohotkey.com/docs/commands/PixelSearch.htm

Re:Learning to code vs. learning to automate by vasili111 on Sunday December 08, 2019 @05:29PM (#21738866)
Yes it is very easy to match image and click on it with AHK. For image matching use https://www.autohotkey.com/docs/commands/ImageSearch.htm for matching use bmp files! bmp files works mach better then png or jpg. For clicks there are several commands, just google them. Also take a look at https://www.autohotkey.com/docs/commands/CoordMode.htm
Re:Learning to code vs. learning to automate by dicytea on Monday December 09, 2019 @06:25AM (#21741788)
Is there any reason bmp would work better than png? I've always used png all this time.
Re:Learning to code vs. learning to automate by vasili111 on Monday December 09, 2019 @09:26AM (#21742886)
I cannot tell why it is so but bmp image matching worked for me much faster then png on several PCs.
Re:Learning to code vs. learning to automate by Thorentis on Sunday December 08, 2019 @11:56PM (#21740489)
Yes! You can search for Bitmaps on the screen. Take a screenshot and crop to the button, save it as a .bmp, and then use the ImageSearch function (https://www.autohotkey.com/docs/commands/ImageSearch.htm).

It will return the (x,y) and you can then use the Mouse functions to interact with that location.

Re:Learning to code vs. learning to automate by vasili111 on Sunday December 08, 2019 @05:31PM (#21738884)
Re:Learning to code vs. learning to automate by eitland on Sunday December 08, 2019 @04:02PM (#21738292)