Is there a good autohotkey script for Roon?

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?

SetTitleMatchMode, 3
SetKeydelay,50,50
^!LEFT::
    ControlSend, , ^J, Roon
    Return
^!RIGHT::
    ControlSend, , ^k, Roon
    Return
^!UP::
    ControlSend, , ^{UP}, Roon
    Return
^!DOWN::
    ControlSend, , ^{DOWN}, Roon
    Return
^!Space::
    ControlSend, , {SPACE}, Roon
    Return

Not sure but I have a Logitech keyboard with media control keys that works great when Roon is active. Seems possible to script.

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.

This has worked for me. Might help you

#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
}
1 Like

Cheers, that worked like a charm, I just added UP/DOWN for volume as well (similar to the others).

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

If using AutoHotKey and the script above, you don’t need to interact with Roon for the most common tasks, you can even have Roon minimized.

The best would of course be if this functionality was built into Roon.

Hi all!

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?

best

Z

Some suggestions here: keyboard - AutoHotkey Equivalent for OS X? - Ask Different

thx @Magnus !

i actually am a super heavy user of Keyboard Maestro :slight_smile:
but alas you can control (at least its a mac limitations) apps that are not in the foreground via Keyboard Maestro :frowning:
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 :slight_smile:
thx!
Z

hi all

for anyone interested i managed to solve this via the amazing @St0g1e

here is how:

1 Like