; For best readibility: in the View menu: switch Word wrap OFF and set zoom to 100% #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 C:\Program Files\MuseScore 4\bin\MuseScore4.exe ; (*) enables Hotkeys when MuseScore4 Window is Active ; (*) Check the path C:\Program Files\MuseScore 4\bin\MuseScore4.exe. ; if different: replace it with your location of MuseScore4.exe ; liberate the Z-key if you have assigned it to a MuseScore shortcut ; redefine this shortcut e.g. in Shift+Z ; ♣============================== INCREASE MEASURE DURATION ======================================= ; inspired by feature request https://musescore.org/en/node/354760 - 'Convert from 3/4 to 4/4 time' ; on the test system it takes 65 seconds to increase the measure duration of 100 measures ; in a score with 10 instruments (staves) ; execute the macro in Staff 1 and make all other staves invisible ; hide all panels in the SideBar with F7, F8 and F9 ~z & m:: ; increase number of beats of measures MsgBox, 4145, Increase measure duration, ( Execute the macro in staff 1. Hide all other staves. Hide also all sidepanels by pressing F7, F8 and/or F9. Select the measure where the increase duration must start. Right-click on an empty spot. Open the window Measure Properties. When you are ready click OK. ) IfMsgBox, Cancel Goto, Finish_Meas_Increase ; see below 🎵 First_Meas := 0 Amount_Meas := 0 Amount_Extra_Beats := 0 CoordMode, ToolTip, Window SetTitleMatchMode, 2 If !WinActive("Measure properties") { ToolTip, Something went wrong.`nSelect the measure where the increase must start`nand open Measure Properties.`nThe macro will exit., , , 4 Sleep, 3000 ToolTip, , , , 4 ; close tooltip (4) Return } SetTitleMatchMode, 1 If WinActive("Measure properties for measure 1") First_Meas := 1 SetTitleMatchMode, 2 ToolTip, Change actual duration of X measures.`n`nInput the number of measures.`nPress Z when ready.`nPress Escape to abort., 235, 186, 4 ; (*change*?) Input, Amount_Meas, , {Esc}{z} If (ErrorLevel = "EndKey:Escape") Goto, Finish_Meas_Increase ; see below 🎵 If Amount_Meas is not number { MsgBox, 4144, Input number of measures, Invalid input.`nThe macro will exit. Goto, Finish_Meas_Increase } ToolTip, , , , 4 ; close tooltip (4) ToolTip, How many extra beats do you want`nin each measure?`nInput the number of extra beats.`nThe maximum is 4 extra beats.`nPress Escape to abort., 235, 163, 4 ; (*change*?) Input, Amount_Extra_Beats, L1, {Esc}, 1,2,3,4 If (ErrorLevel = "EndKey:Escape") || (ErrorLevel = "Max") Goto, Finish_Meas_Increase ; see below 🎵 If Amount_Extra_Beats is not number { MsgBox, 4144, Increase measure duration, Invalid input.`nThe macro will exit. Goto, Finish_Meas_Increase } ToolTip, , , , 4 ; close tooltip (4) If (Amount_Extra_Beats = 1) Text := "beat" else Text := "beats" MsgBox, 4144, Increase measure duration, In a series of %Amount_Meas% measures`nyou want to add %Amount_Extra_Beats% %text%`nto the actual duration. ; for testing Loop, %Amount_Meas% { Send {tab 2} ; to actual duration Sleep, 20 Send {up %Amount_Extra_Beats%} Sleep, 20 Send +{tab 2} ; to OK Sleep, 20 Send {right 2} ; to Apply Sleep, 50 Send {space} ; applies the setting Sleep, 100 Send {left 3} ; to Add to measure number Sleep, 20 If (A_Index = 1) && (First_Meas = 1) Send {tab 1} ; to ➪ Next measure number If ((A_Index = 1) && (First_Meas = 0)) || (A_Index > 1) Send {tab 2} ; to ➪ Next measure number Sleep, 20 Send {space} ; move to next measure Sleep, 100 Send {tab 3} ; to Apply Sleep, 100 } Finish_Meas_Increase: ; HERE 🎵 🎶 🎶 ToolTip, , , , 4 ; close tooltip (4) First_Meas := 0 Amount_Meas := 0 Amount_Extra_Beats := 0 WinClose, Measure properties Return