Media_Play_Pause only works when mapped

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
egelz

Media_Play_Pause only works when mapped

27 Mar 2017, 07:36

I want a Spotify alarm clock.
I am trying to write a script that will execute once and exit (I want the Windows Task Scheduler to run it every morning).
This is what I wrote:

Code: Select all

SoundSet, 30
Send {Media_Play_Pause}
The problem is that

Code: Select all

Send {Media_Play_Pause}
doesn't do anything.
I tried the same script but replaced

Code: Select all

Send {Media_Play_Pause}
with

Code: Select all

Send {Media_Next}
and it worked fine.

I tried mapping Media_Play_Pause like this:

Code: Select all

^Space::Send {Media_Play_Pause}
and it also worked when I hit Ctrl+Space, but I don't want this mapping - I just want it to run once.

What am I doing wrong?
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
Contact:

Re: Media_Play_Pause only works when mapped

28 Mar 2017, 12:32

Sending Media_Play_Pause is kinda unreliable; you have no way of knowing which program is going to react to the press. Try something like this, which signals Spotify directly:

Code: Select all

DetectHiddenWindows On
PostMessage 0x319,, 0xE0000,, ahk_class SpotifyMainWindow ; msg = WM_APPCOMMAND; lParam = APPCOMMAND_MEDIA_PLAY_PAUSE

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, inseption86, jaka1, mikeyww, Rohwedder and 443 guests