Posts: 64
Threads: 19
Joined: Nov 2012
Normally when I want to automate an application, I send a Quick Macros command to grab a handle to a window and then activate it to send the command. Some applications have built in functionality that allow for them to be controlled without focusing the window. For instance, VLC Player has what is called global hotkeys which send keypresses to the application weather or not it is focused. My question is can Quick Macros do this to an application that does not have this functionality. In Adobe Premiere I would like to send the play/pause command without bringing the applications to the front (focusing). I show the code that accomplishes this via focusing the window. Thanks
Macro
int w1=win("" "Premiere Pro")
act w1
'V ;; Space
Posts: 1,335
Threads: 61
Joined: Jul 2006
Try this function
Sendkeystowindow
Posts: 64
Threads: 19
Joined: Nov 2012
10-16-2019, 07:44 PM
(This post was last modified: 10-16-2019, 08:14 PM by pctechtv.)
Thanks for the reply. I seems to work just once after that nothing happens. I remember something about ending a function once ran...
Actually it could be something else. Because I noticed that the key I want to send "V" for Spacebar is only sending a pause not a play. In Premiere it should send both. So maybe it is working. I am testing right now. Thanks
However...
Macro
int w=win("" "Premiere Pro")
int isActive=w=win
if(!isActive) SendMessage w WM_ACTIVATE WA_ACTIVE w
SendKeysToWindow2 w key(V)
works like a charm!
Great info @Kevin, @tanhy, @macrobear, and @Gintaras Thanks so much!