Having Problems allocating media buttons [Beginner]

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Anfly
Posts: 12
Joined: 10 Sep 2022, 16:47

Having Problems allocating media buttons [Beginner]

Post by Anfly » 27 Nov 2022, 01:34

Let me explain the problem as quickly as possible. I cannot assign media button to hotkeys. This is my current script :

Code: Select all

MusicSave:
Gui,2:Submit,Nohide
GuiControlGet,PrevHotkey1,2:,PrevHotkey
GuiControlGet,NextHotkey1,2:,NextHotkey
GuiControlGet,VolupHotkey1,2:,VolupHotkey
GuiControlGet,VoldownHotkey1,2:,VoldownHotkey
GuiControlGet,MuteHotkey1,2:,MuteHotkey
GuiControlGet,PauseHotkey1,2:,PauseHotkey
if(PrevHotkey1 != PrevHotkey){
    Hotkey, %Prev_Hotkey%, PrevFunction, off  
    Prev_Hotkey:=PrevHotkey1 
    Hotkey, %Prev_Hotkey%, PrevFunction, on
}
if(NextHotkey1!=NextHotkey){
    Hotkey, %Next_Hotkey%, NextFunction, off  
    Next_Hotkey:=NextHotkey1 
    Hotkey, %Next_Hotkey%, NextFunction, on
}
if(VolupHotkey1!=VolupHotkey){
    Hotkey, %Up_Hotkey%, UpFunction, off  
    Up_Hotkey:=VolupHotkey1
    Hotkey, %Up_Hotkey%, UpFunction, on
}
if(VoldownHotkey1!=VoldownHotkey){
    Hotkey, %Down_Hotkey%, DownFunction, off
    Down_Hotkey:=VoldownHotkey1
    Hotkey, %Down_Hotkey%, DownFunction, on
}
if(MuteHotkey1!=MuteHotkey){
    Hotkey, %Mute_Hotkey%, MuteFunction, off
    Mute_Hotkey:=MuteHotkey1
    Hotkey, %Mute_Hotkey%, MuteFunction, on
}
if(PauseHotkey1!=PauseHotkey){
    Hotkey, %Pauseh_Hotkey%, PausehFunction, off
    Pauseh_Hotkey:=PauseHotkey1 
    Hotkey, %Pauseh_Hotkey%, PausehFunction, on
}

Reload
Return

PrevFunction:
Media_Prev
Return
NextFunction:
Media_Next
Return
UpFunction:
Volume_Up
Return
DownFunction:
Volume_Down
Return
MuteFunction:
Media_Play_Pause
Return
PausehFunction:
Media_Play_Pause
Return
It keeps giving me the problem "Media_Prev does not contain a recognized action"
Thank you for the help!

User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: Having Problems allocating media buttons [Beginner]

Post by Xtra » 27 Nov 2022, 04:52

This might be what you intended:

Code: Select all

PrevFunction:
Send, {Media_Prev}
Return

Anfly
Posts: 12
Joined: 10 Sep 2022, 16:47

Re: Having Problems allocating media buttons [Beginner]

Post by Anfly » 27 Nov 2022, 16:22

Thanks, it works :D

Post Reply

Return to “Ask for Help (v1)”