Jim Adams
Jim Adams

Reputation: 53

How to I set arrow hotkeys in autohotkey?

I am working at a script in AutoHotkey to allow me to control my computer's volume with my Dell AT101W keyboard (since there are no keys set in Windows to control such things and this keyboard doesn't have controls programmed into it).

What I have so far:

^!(whatever the up arrow is) ; What is up?
     SoundSet +2
^!(whatever the down arrow is) ; What is down?
     SoundSet -2

I am not entirely sure if I have the volume commands correct there, but I have absolutely no idea how to make it recognize the up and down arrow keystrokes (I don't know what they are). Example scripts are appreciated, but are in no way necessary.

Upvotes: 4

Views: 1560

Answers (1)

GregL
GregL

Reputation: 38113

It's actually pretty easy, it's just Up and Down.

Here is a working script that sets a tray message balloon informing you of the new volume after changing it:

^!Up::
     SoundSet +2
     GoSub DisplayCurrentVolume
     Return
^!Down:: 
     SoundSet -2
     GoSub DisplayCurrentVolume
     Return

DisplayCurrentVolume:
     SoundGet, volume
     volume := Ceil(volume) ; Round up
     TrayTip, Volume Adjusted, Volume changed to %volume%`%, 5, 1
     Return

Upvotes: 5

Related Questions