Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send command to unfocused window
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
Copy      Help
int w1=win("" "Premiere Pro")

act w1

'V            ;; Space
Try this function
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

Copy      Help
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! Smile

Great info @Kevin, @tanhy, @macrobear, and  @Gintaras Thanks so much!

Forum Jump:

Users browsing this thread: 1 Guest(s)