I hate having to activate Roon on my desktop PC to control it, so an autohotkey script that can control volume, paus and next/prev would be nice. I tried writing one myself, but I can’t get it to work (only volume works for some reason). Or is this something that Roon actively blocks?
Roon has shortcut-keys already, but the problem is that Roon needs to be active window for them to work. With the help of autohotkey you can send key-shortcuts to non-active windows, but I can’t get it to work.
#Space::
{
IfWinNotExist ahk_exe Roon.exe
return
; Otherwise, the above has set the "last found" window for use below.
ControlSend, ahk_parent, {Space} ; Pause/Unpause
return
}
#Up::
{
IfWinNotExist ahk_exe Roon.exe
return
; Otherwise, the above has set the "last found" window for use below.
WinActivate, ahk_exe roon.exe
return
}
#Left::
{
IfWinNotExist ahk_exe Roon.exe
return
; Otherwise, the above has set the "last found" window for use below.
ControlSend, ahk_parent, ^j ; Previous track
return
}
#Right::
{
IfWinNotExist ahk_exe Roon.exe
return
; Otherwise, the above has set the "last found" window for use below.
ControlSend, ahk_parent, ^k ; Next track
return
}
For others that might want this, here is the script I use. It will work like this:
Ctrl+Alt+Space: pause/resume music
Ctrl+Alt+Left: previous track
Ctrl+Alt+Right: next track
Ctrl+Alt+Up: volume + one dB
Ctrl+Alt+Down: volume - one dB
This works no matter if Roon is active or not or even visible. Even works when gaming in full screen mode, at least for the games I have tried.
The script:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
^!LEFT::
{
IfWinNotExist ahk_exe Roon.exe
return
ControlSend, ahk_parent, ^j ; Previous track
return
}
^!RIGHT::
{
IfWinNotExist ahk_exe Roon.exe
return
ControlSend, ahk_parent, ^k ; Next track
return
}
^!UP::
{
IfWinNotExist ahk_exe Roon.exe
return
ControlSend, ahk_parent, ^{UP} ; Volume +
return
}
^!DOWN::
{
IfWinNotExist ahk_exe Roon.exe
return
ControlSend, ahk_parent, ^{DOWN} ; Volume -
return
}
^!Space::
{
IfWinNotExist ahk_exe Roon.exe
return
ControlSend, ahk_parent, {Space} ; Pause/Unpause
return
}
To use this script: copy/paste into a new textfil, rename file to have “.ahk” ending and double-click it with AutoHotKey installed. Can also be placed in Windows auto-start folder to have it started whenever you log in.
If all you need is to basic operations (volume, play/pause, next/prev) it’d probably be easier to automate those by hitting Roon’s rest api with curl (or a script in literally any programming language) instead of interacting with the gui window
i have been really dying for a solution like this for the mac (ie change volume, skip track etc when roon isn’t active…)
anyone knows of a similar methods for the mac?
i actually am a super heavy user of Keyboard Maestro
but alas you can control (at least its a mac limitations) apps that are not in the foreground via Keyboard Maestro
wondering if anyone has gotten around this somehow?
i do manage to control play/pause via system, hotkeys but its super annoying as if any other media app (even youtube) gets a momentary focus you loose all your roon keyboard shortcuts…makes it super unreliable
thx!
Z
Thank you so much, Magnus and Jeff! This works nicely. Such an useful feature, it is not understandable why it is not built in. Anyway, problem solved thanks to you.