[Solved] How do I send keys to VLC in the background?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

[Solved] How do I send keys to VLC in the background?

Post by ocnuybear » Mon Jul 23, 2018 12:57 pm

Trying to use SendKeystoObjectWizard does not work to insert code needed.

I need to send Space bar & Escape to it.

Code: Select all

GetWindowHandle> - VLC media player,hWndParent
FindObject>hWndParent,VLC video output 00000000034360A0,,1,hWnd,X1,Y1,X2,Y2,result
SetFocus> - VLC media player
CapsOff
Send>

Last edited by ocnuybear on Tue Jul 24, 2018 11:48 am, edited 1 time in total.

ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

Re: How do I send keys to VLC in the background?

Post by ocnuybear » Mon Jul 23, 2018 1:17 pm

Using a Autohotkey Script can do this:

Code: Select all

settitlematchmode,2
escape::
controlsend,,{Escape down}{Escape up}, VLC
return
Like to do the same/similar in MS Please?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: How do I send keys to VLC in the background?

Post by Marcus Tettmar » Tue Jul 24, 2018 9:56 am

Don't have VLC to try it but it would be something like:

ObjectSendKeys>handle,VK32,VK27

VK32 is the virtual key code for space and VK27 is the keycode for escape. There's no escape down or escape up because escape is not a modifier key. Similarly you don't specify Space Down and then Space up, you just send Space.

Also, looks like you are specifying the window title wrong - all windowing functions want a full window title or a substring match followed by '*' (unless you have enabled RegEx when you can then use RegEx). So you probably mean:

Code: Select all

GetWindowHandle> - VLC media player*,hWndParent
Looking at your code I'm not sure if you want to send these to the main window handle or the child object. If the former:

Code: Select all

GetWindowHandle> - VLC media player*,hWndParent
ObjectSendKeys>hWndParent,VK32,VK27
If the latter:

Code: Select all

GetWindowHandle> - VLC media player*,hWndParent
FindObject>hWndParent,VLC video output 00000000034360A0,,1,hWnd,X1,Y1,X2,Y2,result
ObjectSendKeys>hWnd,VK32,VK27
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

Re: How do I send keys to VLC in the background?

Post by ocnuybear » Tue Jul 24, 2018 10:48 am

Hi Marcus,

I suppose the keys should go to the main window.

I'm not sure about the "VLC video output 00000000034360A0" value - it needs to be updated to correct value.

If I use Find ObjectWizard, it just gives me "Window: 10752 [QWidget]" when dragging the plus to VLC window - it is the same everywhere on that window.

ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

Re: How do I send keys to VLC in the background?

Post by ocnuybear » Tue Jul 24, 2018 11:48 am

OK I finally figured it out - I need to use just the string "QWidget" like below:

Code: Select all

GetWindowHandle> - VLC media player*,hWndParent
FindObject>hWndParent,QWidget,,1,hWnd,X1,Y1,X2,Y2,result
ObjectSendKeys>hWnd,VK32,VK27
And it will send whatever key you put in.

I'm learning a lot here.

Thank you Marcus :D

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts