Triggering AHK other than by user keystroke

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HBinswanger
Posts: 17
Joined: 14 Feb 2016, 00:45

Triggering AHK other than by user keystroke

14 Apr 2017, 07:30

It would be immensely valuable to me if I could invoke an AHK routine from another (DOS-based) macro rather than by the user hitting a key.

I don't want the DOS-based macro to do anything at a command prompt. When it does that, it's a little slow and my screen gets messed up when it's done.

I have SETTIMER running to "watch" the program running the macro, so can I activate AHK according to when a certain text string appears on that script's screen? For instance, I could have my macro print on its screen "xqqqx" (or any other unique string). Could that be used to active a whole AHK stanza?

I've thought of having the macro open a new window named xqqqx, and AHK could respond to that, but that's rather awkward. Is there some other way?

Thanks.
Guest

Re: Triggering AHK other than by user keystroke

14 Apr 2017, 09:44

Perhaps try imagesearch? Use a SetTimer to check each second (for example) if it can find "xqqqx" withing your DOS program window, and then trigger your AHK code?
HBinswanger
Posts: 17
Joined: 14 Feb 2016, 00:45

Re: Triggering AHK other than by user keystroke

14 Apr 2017, 14:45

Image Search is a really interesting idea. :bravo: I'll give it a try.
HBinswanger
Posts: 17
Joined: 14 Feb 2016, 00:45

Re: Triggering AHK other than by user keystroke

14 Apr 2017, 16:02

Alas, taking a screenshot of the text proved too crude to match. I don't know how else to get an image file of the text that will be pixel for pixel identical, so I'm pursuing other approaches.
Guest

Re: Triggering AHK other than by user keystroke

14 Apr 2017, 16:18

1 - Perhaps don't use text but something easy as five pipes ||||| that can't be too hard to grab or even redraw manually

2 - How do you start the macro, is it a hotkey you press in your program? If so why not make a context sensitive hotkey in ahk which is the same but isn't blocked, that way when you press the hotkey the program still receives? (Look at the ~ "When the hotkey fires, its key's native function will not be blocked (hidden from the system)." https://autohotkey.com/docs/Hotkeys.htm
Darayavahus
Posts: 36
Joined: 21 May 2016, 03:32

Re: Triggering AHK other than by user keystroke

15 Apr 2017, 01:08

Will "xqqqx" window be certain process/program? Cause you can look for certain program name of the window/process name currently running without need to ImageSearch for it.
Bones
Posts: 28
Joined: 30 Oct 2013, 15:30

Re: Triggering AHK other than by user keystroke

15 Apr 2017, 08:26

Is there some type of inter process communication which the DOS based macro can send and the AHK can receive?
Something like SendMessage? OnMessage?

Other ideas: Write to a file? Could the DOS based macro create an ini file which AHK could read?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 135 guests