remapping keys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shadowfire36
Posts: 2
Joined: 28 Jul 2021, 00:54

remapping keys

28 Jul 2021, 01:01

Hello all ,

I have been trying to remap my volume keys to my prtscr , scroll lock ,and pause break ..

i cant seem to get them to launch , my keyboard has them locked to fn +,f2,f3,and f4 .... (f2 vol-,f3vol+, f4 mute)
can anyone assist in remapping these to the correct 3 keys.

Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1


F4::
Mute:
Send, {Volume_Mute}
Return

F2::
Vol_Down:
Send, {Volume_Down}
Return

F3::
Vol_Up:
Send, {Volume_Up}
Return
[Mod edit: [code][/code] tags added.]
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: remapping keys

28 Jul 2021, 05:20

Try the script below. I left your extra labels (Mute, VolDown, VolUp) in place, which I assume you call from elsewhere in the script. Otherwise, they're not needed and you could make them remaps like the others instead of using Send. Remaps would generally be better. One reason is they will allow modifier keys to be carried through as if you used {Blind} with Send.

Code: Select all

Volume_Mute::PrintScreen

Volume_Down::ScrollLock

Volume_Up::Pause

F4::
Mute:
Send, {Volume_Mute}
Return

F2::
VolDown:
Send, {Volume_Down}
Return

F3::
VolUp:
Send, {Volume_Up}
Return
shadowfire36
Posts: 2
Joined: 28 Jul 2021, 00:54

Re: remapping keys

29 Jul 2021, 00:21

It doesnt give the volume controls to those keys after running the script
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: remapping keys

29 Jul 2021, 06:41

For me, the function keys acting volume down and volume mute worked. The volume up had a problem because I see now Pause can't be used as a key name in a remap because it's also a command name. They work for me when I change the line Volume_Up::Pause to Volume_Up::vk13.

Reference:
Remapping Keys 'Remarks' section wrote:Pause and Break as destination key names (since they match the names of commands). [v1.1.32+]: vk13 or the corresponding scan code can be used instead.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 178 guests