Run autohotkey.ahk file from push2run

Here you are welcome to discuss items of general interest related to Push2Run
Post Reply
bigjuergo
Posts: 6
Joined: Thu Mar 22, 2018 9:45 am

Run autohotkey.ahk file from push2run

Post by bigjuergo »

hi,

how do i run a autohotkey.ahk file from push2run?

i want to say:
ok google, tell my computer to press e button
then push2run should run the script <pushebutton.ahk>

thank you for help!
RobLatour
Site Admin
Posts: 1016
Joined: Mon Feb 19, 2018 11:43 am

Re: Run autohotkey.ahk file from push2run

Post by RobLatour »

The quick answer is that you just need to create an .ahk file to do what you want to do, and then set it up in Push2Run as follows:

In Push2Run card's open field, enter the full path and file name of your .ahk file, for example:
c:\myscripts\SendE.ahk

Also on the Push2Run card, enter a description and some suitable phases to listen for.

I have attached an example Push2Run card to this post (just download it and double click on it to open it up).

Having that said, if all you really want to do is send an 'e' the .ahk file only needs to contain one line, as follows:
send e

However, more likely you probably want to send your 'e' to a specific application, so the .ahk script needs to also ensure it is running and is the active windows before 'e' is sent.

Hope this helps,

Rob
Attachments
send_an_e.p2r
(484 Bytes) Downloaded 581 times
bigjuergo
Posts: 6
Joined: Thu Mar 22, 2018 9:45 am

Re: Run autohotkey.ahk file from push2run

Post by bigjuergo »

thank you for the hint.

basically i want to voice control my cycle training game zwift.
the connection between goolge home and push2run works.
I have managed to open programms, but i do not have manged to send a key to a programm.

therefore i have to send the key "3" for chaning the view.

can you please help me how to wirte the *.ahk file that it send the number "3" to the programm called Zwift?

thank you for the very helpful program push2run!!! :) that makes really fun to use
bigjuergo
Posts: 6
Joined: Thu Mar 22, 2018 9:45 am

Re: Run autohotkey.ahk file from push2run

Post by bigjuergo »

ok it worked as you said the desired programm has to be activated in front.
would be nice to send it directly to a Programm.

:)
RobLatour
Site Admin
Posts: 1016
Joined: Mon Feb 19, 2018 11:43 am

Re: Run autohotkey.ahk file from push2run

Post by RobLatour »

I don't have much experience with autohotkey, perhaps you can post on their forum.

However, here is an example of how it can be done using a .vbs script

viewtopic.php?f=9&t=14

The example is for sending keys to the windows calculator. However with a bit of editing, I'm fairly sure you could get it to do what you want.
Post Reply