I am trying to remap my play pause button

Get help with using AutoHotkey and its commands and hotkeys
I400HAR
Posts: 4
Joined: 10 Jul 2020, 02:55

I am trying to remap my play pause button

10 Jul 2020, 03:58

I am trying to remap holding down my play pause button for 1 second to runing example.exe how would I do this? Also Im pretty sure this is in the wrong forum. Sorry and thanks for helping.
Last edited by BoBo on 10 Jul 2020, 04:06, edited 4 times in total.
Reason: Moved to 'Ask for Help'.
User avatar
boiler
Posts: 5640
Joined: 21 Dec 2014, 02:44

Re: I am trying to remap my play pause button

10 Jul 2020, 08:31

Try this:

Code: Select all

$Media_Play_Pause::
	KeyWait, Media_Play_Pause, T1
	if ErrorLevel
		Run, example.exe
	else
		Send, {Media_Play_Pause}
return
I400HAR
Posts: 4
Joined: 10 Jul 2020, 02:55

Re: I am trying to remap my play pause button

11 Jul 2020, 03:41

Thanks but it didn't work any other ideas?
User avatar
boiler
Posts: 5640
Joined: 21 Dec 2014, 02:44

Re: I am trying to remap my play pause button

11 Jul 2020, 08:56

Unfortunately, it seems that the media keys act differently when used as hotkeys. It will sort of work if you remove the $ in front of the hotkey, but then it can give a warning message about the number of hotkeys that have been triggered. Perhaps someone else knows away around that.

The approach will work with other keys in case that is a good alternative for you.
I400HAR
Posts: 4
Joined: 10 Jul 2020, 02:55

Re: I am trying to remap my play pause button

30 Jul 2020, 03:54

So when I remove the $ runing example.exe works but then the the play pause button doesn't work (give the too many hotkeys pressed error). Hopefully Ill get it working one day but thanks for all the help.
lexikos
Posts: 6972
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: I am trying to remap my play pause button

30 Jul 2020, 22:46

A common issue is that media buttons register as "artificial", so are not considered to be "physically" down. KeyWait therefore returns immediately. You can confirm whether this is the issue by checking whether KeyHistory shows an "a" for that button. If it does, you can work around it by re-working the script to use "Media_Play_Pause up::" to detect when the button is released.

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Burnsy, karkas, majstang, TAC109, WlodiXowy and 30 guests