An "Auto HotKey" script for adding short rhythm groups in MuseScore

• Apr 15, 2020 - 03:52

I devised a short AutoHotkey script to automate the process of adding short rhythm groups of notes in MS (Windows).

It works like this once Auto HotKey (macro program) has been installed and the script is running:
Select any rest, then
Pressing "Ctrl+1" creates this: MS group 1.jpg
Pressing "Ctrl+2" creates this: MS group 2.jpg
Pressing "Ctrl+3" creates this: MS group 3.jpg
Pressing "Ctrl+4" creates this: MS group 4.jpg
Pressing "Ctrl+5" creates this: MS group 5.jpg

For anyone not familiar with using AHK, here are instructions:
1. Download and install the small free program Auto Hotkey.
2. Download the attached .txt file, put it somewhere handy like on the desktop.
3. Delete the extension of this file and change it from .txt to .ahk (a warning message might appear but click OK);
3. Right-click the .ahk file and select "Edit Script" to read it (text will appear in Notepad), then close Notepad;
4. Right-click the .ahk file and select "Run Script".
5. Open any MuseScore file.
Then ......
6. Click on any rest in MS and select either Ctrl+1,Ctrl+2,Ctrl+3,Ctrl+4 or Ctrl+5.

The appropriate rhythm group will immediately be created, all notes pitched as A's. Re-pitch as necessary.
The hotkeys can be customised by editing the script, as can the actual note groups.

Here's an explanation of some AHK terms, again for the uninitiated in AHK terminology:
"SetKeyDelay,50" - this makes sure the speed of key presses is not too fast. Do not change!
"^" means "Ctrl"
"^1::" sets the "hotkey" (trigger which starts the sequence of keypresses) as "Ctrl+1"
"send" simply means "type"
"4.a3a" is the sequence of keypresses giving the rhythm group MS group 1.jpg in MS
"{esc}" means the escape key. This is to turn off Step-time Note Input (delete this in the script if you'd like to continue in step-time)
"Return" stops the process.


Thanks Jon, especially for your clear instructions.
Maybe you're interested in the following:
A few days ago I published an AutoHotKey file with which you can apply all symbols from Palette.
E.g you type 'P' and the dynamic is attached. ALL symbols of the advanced workspace have a shortcut.
Type 'M.' and marcato staccato appears and so on.
You can find it on
It is the first instalment of a series, which speeds up the workflow incredibly.
It has given me also the opportunity to rethink accessibility.
And questions about reducing manual stress.
One of the aims is to eliminate using the mouse. I'm almost there and will publish about it.
It's a pity that AFAIK there is no free alternative to AutoHotKey for other platforms.

So, I had some fun and added this code to tmy AHK script:
AHK script Emglish Country Garden tune.JPG

This code means that after selecting a rest in MS and pressing "Ctrl+6", MS automatically writes out the tune "English Country Gardens"!

Haven't had so much fun in ages, so I made a screen capture video of this in action. The video is running in real-time - no speeding up! Honest! (Please note that after the tune was automatically added, I shift-dragged the first part of the tune and put it up an octave so it sounded correct). Make sure your sound is on....

Amended script attached. Change ".txt" to ".ahk".

I'm a Musescore user but I don't understand programming. I found this tool that you created very interesting, however, when I download the file
"Musescore add dotted rhythms and other rhythm groups by Jon Ray.txt" appears only a notepad. I can't find an option to download the file like any other, I have the option to download only the link.
Under the link but the option "Run script" does not appear.
Could you please guide me?
Much obliged...

Attachment Size
Arquivo.pdf 232.41 KB

In reply to by mjbartemusica1

You didn't rename the file (correctly). It's still a txt-file as you can see in your video at second 16 in the popup when you hover over it.
Windows by default doesn't show file extentions for known file types; which is a very dangerous thing. Open your explorer and turn of that view option and you'll be able to really rename the file and remove the .txt extention from it.

Do you still have an unanswered question? Please log in first to post your question.