AutoHotkey Kit for MuseScore
The topic of this forum thread is an extensive collection of macros for the Windows platform.
The document AutoHotkey_for_MuseScore.pdf describes how you can build (parts of) this collection yourself.
Because of its size it comes in two attachments. Please merge the two to get the page numbering right.
The pdf is divided in two parts: an Intro section and a Reference section.
The Intro section includes a hands-on approach in case you are a first-time user of AutoHotkey without any technical background.
The kit contains several files aimed at the learning process.
There is a step by step explanation of what you have to do yourself to get the macros you're interested in working.
The central issue of the Intro got the name 'Defined State'.
If all aspects of your preferred screen layout are instantly reproducible it's not difficult to imagine what the automation of mouse actions combined with MuseScore shortcuts could do.
You get instant access to all frequently used Inspector fields and to the most important properties hidden in subwindows.
For reasons of clarity this part is rather verbose, meant for users who see sense in automating constantly recurring tasks but shrink in some degree from the technical issues.
There are many info screens and tooltips to assist you in preparing and using the macros.
Many macros don't need additional data, many others do.
The additional data constitute the DIY part of the Kit. They include numbers and images.
Most images - of items in the Statusbar and in the Inspector - serve to verify which elements are selected.
Most numbers are coordinates of hotspots or surfaces operating on the screen or on sub-windows of MuseScore.
The depository of the coordinates and all other values is the file Coordinates.ahk.
Essential to this project is easy maintenance, especially after updates of MuseScore.
That's why the 'Master' group of macros contains utilities to test almost all DIY items.
Coordinates.txt to rename in Coordinates.ahk (see post 2 about renaming)
HotKeys_in_prefix_order.txt is an inventory of all hotkeys plus the macro-group in which they occur.
The kit includes all necessary tools to help you in determining additional data and creating images.
Most tools reside in the Master file, others in external files.
The external ones are PixelMousing.ahk and Set_Surface_Coordinates.ahk
In the attachments they have the extension .txt.
Give them again the extension .ahk. See pdf page 6 about renaming them.
There are two supporting Notepad files into which you can paste the found numbers.
They open automatically while using a tool. These are Image_Coordinates.txt (pdf page 20) and Hotspot_Coordinates.txt (pdf page 27).
PixelMousing.txt to rename in PixelMousing.ahk
Set_Surface_Coordinates.txt to rename in Set_Surface_Coordinates.ahk
In reply to Post 2 The kit includes all… by MichLeon
First-time users of AutoHotkey are invited to a hands-on experience.
A few experiments to get acquainted with some basic concepts.
E.g. how CapsLock + S brings you immediately to the window Preferences -> Shortcuts -> Searchfield.
Creating images is another important DIY aspect, relevant for each user. See the pdf on page 13 and especially 18-21, the preferred method.
The attachments to this post are primarily meant to facilitate the learning process:
Learn.ahk, Master_stripped.ahk, Coordinates_stripped .ahk and F1_ColorSearchSelect_stripped.ahk
Again: rename these .txt files in .ahk files
The DATA text files are there to help you in your DIY manufacturing process: they act like bookkeeping guides.
These are Master_stripped_DATA.txt and F1_Stripped_DATA.txt. Don't change the extension of these .txt files!
You can immediately benefit from 'Apply Palette Symbols' - post 6 - because DIY items for this macro are not needed.
Coordinates_stripped.txt to rename in Coordinates_stripped.ahk
F1_ColorSearchSelect_stripped.txt to rename in F1_ColorSearchSelect_stripped.ahk
Learn.txt to rename in Learn.ahk
Master_stripped.txt to rename in Master_stripped.ahk
In reply to [inline:Menus_F1_F2_Learn… by MichLeon
The topic of this post is the Master file (full version). It is also the first chapter of the Reference section of the pdf.
The first function of the Master file you could compare with a kind of Central Station.
See page 42 of the pdf, info screen #1 which shows hotkeys (AHK-shortcuts) to launch every macro group and several tools.
Screen #2, the toolbars part. In the pdf you find more info about how to restore the Defined State of the toolbars by pressing a shortcut.
Under the header 'Ergonomy' the Master file houses a series of shortcuts which have MuseScore equivalents but are easier accessible. For instance CapsLock + A instead of Control + U for Full Screen.
Or Z + Up/Down/Left/Right for scrolling instead of comparable mouse wheel actions.
As much as possible eliminating the use of the mouse is an important theme in this project.
A related series of shortcuts resides under the header 'Workflow'. E.g. in Continuous View adding spacers, setting an extra distance above the staff. In each view: open measure or staff properties, make staves small, exclude from measure count.
Header 'Zoom and View': Single Page, Page Width, Whole Page, Two Pages. P + 1,2,3.. zoom 110%, 120%, 130% ..
Under the header 'Utilities': many commands to restore aspects of the Defined State. But also the commands for maintenance purposes, see p. 47.
The file Check MuseScore coordinates.mscz supports semi-automatic checking of almost all hotspot coordinates.
Check MuseScore coordinates.mscz
Master.txt to rename in Master.ahk
MuseScore_logo_round.jpg (as an example. See pdf page 43)
In reply to Post 4 The topic of this… by MichLeon
The F1-macrogroup Color Search and Select houses three related families of macros.
The first explores what you can do with color. The fact that a selected note has its voice color has many applications. The first that comes to mind is very basic with an incredible impact on the workflow. Pressing Alt + Z moves the mouse to the voice 1 element and clicks it.
As long as the selected element remains visible on the screen all kinds of edits are a shortcut away.
The converse of this situation: we color elements - preferably notes - to act as searchable items.
This opens many possibilities. The first series of applications is range selection and reselection. Start and endpoint can be immediately revisited. E.g. a recurring rhythmical motive. Four color pairs are dedicated to this task.
In the second series of applications colored notes are used as markers for whatever. E.g. attached annotations. Searching a screen takes about 50 ms. The job of searching a large score can be optimized by limiting the search area. This verges on global navigation.
A total of 26 colors is available. 14 of them correspond with two colorschemes used frequently by the colored notes plugin.
See pdf Intro section p 34-36 and in the Reference section p 55-59.
The second family occupies itself with the automation of the Selection Filter. Let the macro do the clicking. Prepare cue material.
The third family looks more to the tradition of the contextual menus. It provides shortcuts for selecting all similar or all same subtype elements in range, score, system, staff, voice or staff+voice.
Also shortcuts for all notes of the same duration, pitch, notename or voice in range, score or staff. See page 55 of the pdf.
It is important to prevent potentially disastrous selections. These could happen when you apply a command meant for elements while you have actually a note or rest selected.
Read on page 56 what is needed to neutralize mistakes.
F1_ColorSearchSelect.txt to rename in F1_ColorSearchSelect.ahk
In reply to Post 5 The F1-macrogroup… by MichLeon
The F2-macro group 'Apply Palette Symbols' gives shortcuts for all symbols in the Advanced Workspace.
In https://musescore.org/en/node/303798 you find the first version of this script. A few mistakes have been corrected in the current version.
The new version includes an Advanced AutoHotKey workspace enlarged with the Gould arrow quartertone accidentals, some Time Signatures and a graphic barline.
The info screens on pages 62-67 show all shortcuts for each of the 23 palettes.
The macro cooperates with the Advanced AutoHotKey.workspace. See page 6 of the pdf about where to put this file.
See also a comparable script of user flavius.vitellius on https://musescore.org/en/node/315466 which has been composed in a more elegant way but is a bit more difficult to understand for users less versed in AutHotkey syntax.
The idea behind the scripts of this collection is that most of them can easily be adapted to specific wishes without much knowledge of AutoHotkey. Quite a few could certainly be streamlined to gain milliseconds in execution time.
A technical supplement at the end of the pdf shows the economical way in which AutoHotkey manages resources.
Advanced AutoHotKey_workspace.txt to rename in Advanced AutoHotKey.workspace
F2_Apply_Palette_Symbols.txt to rename in F2_Apply_Palette_Symbols.ahk
In reply to Post 6 The F2-macro group … by MichLeon
The F3-macro group 'Navigation' is a family with two members: Global and Micro Navigation.
See page 71 for the Global Navigation shortcuts. The hotkeys from highest to lowest staff and vv in Continuous or Page View - very useful for scores with many instruments - are answering forum requests. They have been tested in scores with 40 staves.
The Continuous View variant has helpscreens to assist you in determining two crucial numbers.
With the Micro Navigation hotkeys you navigate - preferably from a note - to other nearby elements for instant editing of their most important properties. These shortcuts are combinations with the Windows key. They too advocate a workflow of minimal manual mouse movements.
Page 74 of the pdf shows a list. For instance with Win + T a text gets selected and we can immediately change its size and appearance (bold, italic, underlined).
Or Win + V with which you can change the velocity of consecutive notes. The value of the previous velocity is transferred to the next, ready to be changed by arrowkeys or wheel.
With Win + B you move from note to beam. When adjusting beams we encounter a more general problem. Often when we need to change the position of an element with the arrowkeys the stepsize is too big.
For the positional finetuning of elements the F3- macro group cooperates with the F4-group.
F3_Navigation.txt to rename in F3_Navigation.ahk
In reply to [inline:Help_F1_F2_F3.png]… by MichLeon
F4-macro group 'Positioning'. See page 80 of the pdf for the first info screen of this group. If necessary we can change positional offsets even with 0.01 sp.
Beams, ties and stems have separate sets of hotkeys. Especially beams and ties are areas where MuseScore 4 hopefully will produce more intelligent default positions.
Improving ties is one of the oldest recurring requests on the forum
The handling of beams includes 'Grow' to optimize beam distance for very short notes following recommendations of Elaine Gould in 'Behind Bars'.
Getting tied dotted notes right is one of the most time consuming jobs in MuseScore. For the most frequently occurring situations the hotkeys are real timesavers but certainly not for all.
Categories: stemdirection, tiedirection, top or bottom note, line or space note, mirrored, inner note left or right of stem.
This results in many hotkey combinations. The keys to be pressed must follow some kind of memorizable logic. See page 91 of the pdf for the keyboard layout.
The header 'Numeric Fields' unites a set of hotkeys for fast access to and change of numeric values in Inspector rectangles. Page 90 gives the list.
In several cases this makes alternative approaches possible e.g. for correcting all aspects of beam angles.
Sometimes the only way to avoid collisions is using masking text. This technique has interesting usecases.
Copying offsets and custom positions - especially of beams - looks like a welcome addition to this macro group.
Unfortunately the settings of ties are not exposed in the Inspector. After copying an adjusted cluster all your settings get lost.
F4_Positioning.txt to rename in F4_Positioning.ahk
In reply to Post 8 F4-macro group … by MichLeon
The F5-macro group 'Alternating Time Signatures' distinguishes between 'Real' and 'Virtual' Time Signatures.
The virtual ones operate by changing the actual measure duration. The real ones follow the corresponding beaming patterns.
By way of example three time signatures were added to the Advanced AHK workspace: 2+3/8, 3+2/8 and 3+2+2+3/8.
See page 93 of the pdf for the info screens.
If you use the 'Virtual' technique you will probably need the macros residing in Z+B, 'Set beam properties' to quickly change the beaming patterns.
This is an instance of applying palette symbols in a loop for a specific task, facilitating some workflows.
F5_Alt_Time_Sigs_and_BeamProps.txt to rename in F5_Alt_Time_Sigs_and_BeamProps.ahk
In reply to Post 9 The F5-macro group … by MichLeon
The F6-macro group 'Advanced Dynamics' specialises in two tasks.
The first task is to apply upto five dynamics - crescendo and diminuendo lines included - in one go for instance by typing pppp in an InputBox.
Also to replace a wrong dynamic. Selected is a note with f(orte) attached. Type '=mf'. To replace while retaining the original position of the dynamic type '.mf'.
The second task is applying single dynamics. The dynamics are on standby. While working in MuseScore you can activate them at any moment.
F6_Advanced_Dynamics.txt to rename in F6_Advanced_Dynamics.ahk
In reply to Post 10 The F6-macro group … by MichLeon
Via the F7-macro group 'Master Palette' and by pressing Z + S you get access to all technique symbols from sections of the Master Palette: strings, plucked, harp, percussion, vocal, wind, guitar, keyboard, conductor. Plus brackets, braces, parentheses etc. The info screens are on pages 103-106.
After attaching the symbol it moves 4 spaces up to land outside the staff and remains selected for positional fine tuning. Pedal and organ (heel-toe) signs are placed under the staff.
The sensitive area around symbols seems to vary considerably. In practice this means that not every symbol always will get selected. Page 107 of the pdf describes what to do when this happens.
Pressing Z + O gives access to the 34 ornaments which are not in the Advanced Workspace. Info screen on page 107.
Frequently occurring symbols - ornaments included - you will probably house in a custom palette. Selecting and fast positioning of the less frequently used is the main task of this macro group.
Entering 'pdf' in the InputBox brings up a pdf showing the ornament symbols and their shortcuts.
F7_Master_Palette.txt to rename in F7_Master_Palette.ahk
In reply to Post 11 Via the F7-macro… by MichLeon
By pressing Z + P in the F8-macro group 'Note Input' you activate 'Pitch before Duration'. A frequently requested feature. Info screens are on page 108 and 109.
Wherever possible the commands follow their MuseScore equivalents. Where they have to deviate they follow a pattern which hopefully can be easily memorized.
With Z + N you can produce Rhythmic Note Patterns to repitch them later. Z + R is for creating templates with rests colored according to the beaming pattern of the time signature.
Z + X focuses on creating accidentals in a loop, including the Gould arrow accidentals.
F8_Note_Input.txt to rename in F8_Note_Input.ahk
In reply to [inline:F8_Pitch_before… by MichLeon
The F9-macro group 'Specials' is a miscellaneous collection. See page 113 for the info screen.
Especially useful in this collection: Z + Q create cue. Z + G add graphic accidental to ornaments. Z + L set pedal lines and Z + M mask measure(s).
Also: set memorypoints valid for a session with M + F1, F2 etc. and click them with M + 1, 2 etc. Useful for less used Inspector hotspots like tuning, time stretch, text line details. See page 121.
F9_Specials.txt to rename in F9_Specials.ahk
In reply to Post 13 The F9-macro group … by MichLeon
When your preferred screen layout shows no toolbars at all this simple macro shows the score status: transposed or concert pitch.
So the F10-macro 'group' has got only one function, very useful when you prefer MAX CANVAS as Defined State.
F10_Change_Score_Status.txt to rename in F10_Change_Score_Status.ahk
In reply to Post 14 When your preferred… by MichLeon
The F11-macro group 'Wheel Note Input' answers forum requests for mouse note input combined with wheel for duration.
It cooperates best with a mouse with two extra buttons. Info screen on p 123.
F11_Note Duration_MouseWheel.txt to rename in F11_Note Duration_MouseWheel.ahk
In reply to Post 15 The F11-macro group … by MichLeon
This group was coined 'Independent Hotkeys'. The macros are not context sensitive.
It is a collection of examples to perform tasks also when MuseScore is not active or does not exist.
On my desktop there is its shortcut icon. A doubleclick enables the hotkeys shown on page 124.
With \ + M you launch the MuseScore ahk master file.
Especially relevant for MuseScore is Control + Win + Z.
It restores all aspects of the Defined State when MuseScore is minimized.
The commands to position one or two windows on the screen turn out to be very useful as well.
The commands 'select font' and 'select fontsize' were real timesavers in writing 'AutoHotkey for MuseScore'.
Independent_Hotkeys.txt to rename in Independent_Hotkeys.ahk
In reply to Post 16 This group was… by MichLeon
Most commands in the .txt attachment are an addition to the macro group of F1_ColorSearchSelect. (Post 5)
The main topic of these extra hotkeys is 'Repeating List Selections'.
Control + Win + LeftButton starts List Selection.
While making the selection the coordinates of the notes are written to the clipboard.
Control + Win + RightButton ends List Selection.
Add new notes to the selection with Alt + Win + LeftButton. Finish this with Alt + Win + RightButton.
Reselect the notes with Shift + Win + LeftButton or CapsLock + F.
Remove articulations of selected notes with CapsLock + R.
Give them another articulation using 'Apply Palette Symbols' (Post 6)
It can happen that in the meantime you have to go to another nearby page.
In that case you'll need the macros of the Defined Page which make it possible to revisit the original page with the list selection keeping the coordinates intact.
Getting this feature working entails determining some drag distances.
The pdf describes how to do this.
There are also new commands for making upto 4 different simple range selections. They don't use colors as 'memorypoints' as in the F1 macro group.
To revisit the selections after a change of page the macros of the Defined Page are needed.
New commands too for fast navigation on a Defined Page. The page is divided in regions. The commands search for the last barline of a system in a specific region using zoomfactors 100% or 89%.
Finally the attachment includes new navigation commands in Page View. They follow the same method searching for barlines at the end of a system using 12 zoomfactors between 89% and 200%.
These navigation commands best reside in the Master section of this AHK Kit. (Post 4)
There are info screens for all commands.
Extra__Selection_and_Navigation.txt with more info
In reply to Post 17 Most commands in the… by MichLeon
This new group of macros automates the Mixer of MuseScore. It completely eliminates mouse movements and enables fast access and change of all control elements in the Details Area and the Track Area.
Instruments with a maximum of three staves are supported, so organ, piano or instruments with two linked staves e.g. classical notation plus tablatures for 2 different plucked instruments.
The documentation in the pdf describes the DIY items needed to get the Mixer in a Defined State.
You can use this macro group as a stand-alone or include it in the Master file of this AHK Kit. (Post 4)
All hotkey combinations start with F10. The MuseScore shortcut for Toggle mixer can be cleared. Its function is replaced by F10 + F11.
The command Control + F10 toggles the Mixer status: 'Three Staves' or 'One Staff'. Edits in the Details Area go faster in 'One Staff' mode which will be valid for most instuments. For instruments with more than one staff switch to 'Three Staves' mode.
The documentation describes also how you can customize the Mixer defaults.
The txt file includes an extended version of the Initialisation of the Play Panel. This replaces the utility IPP in the Master file of post 4, invoked by the hotkey Z + U and input IPP.
Initialisation is needed when after launching MuseScore the Play Panel is absent or docked in the Inspector. It has to be undocked and positioned on the screen.
The new version accounts for the possibility that the Play Panel is an inactive tab in the Inspector.
A comparable Initialisation of the Mixer seems less frequently needed. Nevertheless there is a new utility for it: Z + U and input IMXR.
There are additions to the Play Panel macros as well: the 5 commands lowest in the Info Screen.
In combination with the Mixer macros they speed up the workflow considerably.
Extra__Mixer.txt to rename in Extra__Mixer.ahk if used stand-alone.
In reply to Post 6 The F2-macro group … by MichLeon
Correction in Post 6:
The Advanced AutoHotKey workspace attached as .txt file will not work.
Use the attached 7-Zip file instead.
In MuseScore 3.6 the position of the colorpicker of the Note Anchored Line has changed.
This is mentioned on p. 13 of the pdf but not in the DATA text files.
This means for Inspector item IN_012 (color picker rectangle black):, select successively a text (or dynamic), a note and a note anchored line. Choose the X-coordinate so that it is valid for these three situations.