#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance force ; Replaces script (Reloads). #Persistent ; to make it run indefinitely #IfWinActive ahk_exe S:\MuseScore 3.6 portable\MuseScorePortable\App\MuseScore\bin\MuseScore3.exe ; Enables Hotkeys when MuseScore3 Window is Active ; Enables Hotkeys when MuseScore3 Window is Active #Include Coordinates_stripped.ahk ; All coordinates are managed in this external file ; The Include directive causes the script to behave as though ; the specified file's contents are present at this exact position ; Replace the path S:\etc. with your location of MuseScore3.exe ; this is a comment. Comments are not read by the program so don't influence the speed of execution ; the lines above from #NoEnv to #Include Coordinates_stripped.ahk are automatically read ; when Learn.ahk is launched. This is called the Auto-execute Section ; lines starting with # are called 'directives' ; NB: After editing this file you can reload it from the Master with [ + , ; ♣================================================================================================ ~[ & l:: CoordMode, Tooltip, Screen Tooltip, LEARN, ToolT_Learn_X, 0, 1 ; tooltip (1) Learn Return ~[ & ,:: ; edit file Learn.ahk (open default text editor) If WinExist("Learn.ahk - Notepad") WinActivate else Edit Return ; ♣========================================== LEARN =============================================== ; example Hotkey T + A. This duo is called a 'hotkeycombination' ; the first key is called the prefix key or prefix for short ; this key is 'free' after a default installation of MuseScore ; meaning the key is not in use as a shortcut within MuseScore ; the same is true voor the U key ; if T and/or U is already in use you could redefine the shortcut to 'liberate' the key ; see also the example below where the P-key is liberated ; the prefix key is preceded by the tilde sign ~ ; this prevents that the T is stolen by AutoHotkey ; so you can e.g. still type your lyrics without loosing the letter t or T ! ; Hotkey (#1) ~t & a::Click, 133, 41 ; this is a comment. Comments are not read by the program ; the hotkey T + A opens Menu Add ; replace 133 and 41 by the coordinates valid for your screen! ; alternatively we could use the MuseScore shortcut to open this menu ; NB: in the next variant the semicolon followed by a space actually disables hotkey (2) ; this is necessary for duplicate hotkeys are not allowed (when they operate in the same context) ; so if you want to enable Hotkey (2) you have to disable Hotkey (1) ; by putting a semicolon followed by a space in front of each line of the hotkey ; Hotkey (#2) ; ~t & a::Send !a ; as if you press Alt + A ; now we want to exchange the numbers 133 and 41 for a generalised approach ; we are going to use containers which we fill with these numbers ; we give the containers understandable names ; and have to respect the writing rules (their 'grammar' or 'syntax') e.g. the use of spaces ; Menu_Add_X := 133 ; the containers act as variables which can contain any number ; Menu_Add_Y := 41 ; using the lingo we say "The VARIABLE Menu_Add_X has the VALUE 133" ; for this assignment of values we use another file: Coordinates_stripped.ahk ; so replace the numbers 133 and 41 at the top of Coordinates_stripped.ahk by the numbers found by you. ; when you launch Learn.ahk the program will read the values from Coordinates_stripped.ahk first ; these values at the top belong to the 'autoexecute section'. ; when the core AHK program encounters the first hotkey in Learn.ahk it stops this automatic reading ; so now we can write the click action in this way as Hotkey (#3) ; ~t & a::Click, %Menu_Add_X%, %Menu_Add_Y% ; in this case the percentage signs are needed ; to retrieve the contents of the variable ; wherever macros need this action it will be written in this way ; this has big advantages: you have to input coordinates only once in a file which will be ; read by all files which use coordinates or other values e.g the numbers of colors. ; This file is Coordinates.ahk. (As mentioned: Learn.ahk uses Coordinates_stripped.ahk) ; Coordinates.ahk only contains data ('values'), no actual hotkeys. ; when something changes in MuseScore after an update you change values only in this repository ; the AHK kit has several tools to check the validity of coordinates. Tools are part of the Master.ahk ; continuing with the Add_Menu we could write another hotkey: ~t & c:: ; add Composer text - Hotkey (#4) the next two lines 'outcommented' ; Click, %Menu_Add_X%, %Menu_Add_Y% ; we start here immediately with a new line because this hotkey needs more lines ; Sleep, 50 ; AHK sleeps, so MuseScore gets some extra time to react ; (to open the Menu) sleeptimes are of course system dependent (how heavy is the actual CPU-load) ; but this is of course the way to go Send !a ; open Menu Add Sleep, 100 ; give MuseScore some time (100 milli seconds) Send t ; makes 'Title' blue Send {Down 2} ; selects menu item 'Composer' Send {enter} ; activates 'Composer text' Return ; finishes the hotkey ~] & l:: MsgBox, 4132, Exit Learn ] + L, Are you sure you want to exit? IfMsgBox, Yes ExitApp Return