Autohotkey macro for Musescore

• Nov 5, 2017 - 10:27

I am beginning to study Autohotkey, a freeware tool to automate tasks. I'm afraid it works only for windows but there is a similar tool for linux. What I try to acomplish with this tool is to have a macro that adds a staccato accent to the current note and moves on to the next note. I assigned ctr-p to staccato in musescore. But I did not have any success. Maybe the combination of an external macro processor and the internal key mapping of Musescore ist not even possible. Has anybody successfully tried something similar?


Comments

I've never used anything like this, but ctrl-p is the shortcut for Print. If you didn't clear that shortcut, it may be part of the problem.

In reply to by SlyDr

As I said, I'm not familiar with what you are doing, I was just pointing out a possible solution to your problem or a future problem. Twice defined shortcuts in MuseScore have been know to randomly apply the shortcut and do things you don't want.

As far as the accents go, you can apply accents to multiple notes at a time. I don't remember the default, but I have shift+s as my shortcut for staccato. Here is the link to select multiple items if you need it. https://musescore.org/en/handbook/selection-modes#shift-selection The methods in MuseScore are very standard, so you probably don't need the link. You can adjust several or all of the accents using the inspector all at once. Selecting accents is a bit different that selecting notes to apply accents to.

If you want every accent in the piece adjusted, right click one and chose select>all similar items.

If you want several measures worth adjusted, select the range of measures, right click and chose select>all similar items in range selection.

Note: both of the above methods will select all accents like staccato and marcato.

If you only want a specific type of accent selected chose your range, right click one of the type and chose select>more... This will bring up a dialog box that will give you great flexibility in choosing the accents you want to alter.

If this doesn't help then explain better what you are trying to do.

In reply to by mike320

The idea beneath my attempt is to achieve a set of handy shortcuts to move from note to note and put the approriate accents to the notes with automtically proceeding to the next note. The test with staccato had only been a proof of concept. I'm afraid it has failed.

Others have reported success doing this sort of thing, so in principle it is possible. I have no idea what the technical challenges might be though. What went wrong when you tried? As mentioned, Ctrl+P is handled specially so I can imagine it would cause problems, why not stick to the default Shift+S? The correct sequence to apply a staccato then move to the next note would be "Shift+S, Right".

But more importantly, I would just reiterate something that was observed in this thread - while a macro to do this might be interesting as proof of concept, it's also totally unnecessary. It is already much easier to apply staccato to a whole series of notes by simply selecting them first and then entering the staccato. You might find some of the other things you were planning to resort to these sort of macros for also already are handled in easier ways, could be good to ask here first before spending a lot of time on this.

In reply to by Marc Sabatella

I am afraid I have to defend myself for changing some Musescore shortcuts. When I switched over from Capella to Musescore particularly the default shortcuts for adjusting the note length caused me some pain. I know, what you're used to works best. But frankly, I really judge the Capella suggestions below as quite logical:

1: 1/1
2: 1/2
3: 1/32
4: 1/4
6: 1/16
8: 1/8

So I changed some of my Musescore shortcuts to match with those I allready knew and used on a regular basis. This is also the explanation for the unusual staccato shortcut, if I remember this correctly.

But back to my attempt to save some keystrokes. When working on bigband scores I often run into situations where different and changing accents have to be applied from note to note. The idea behind my unsuccessfull struggle was to cut the effort for marking the notes to nearly half. I see quite a lot Musescore users seem to think different, that's OK with me. I remember that I had discussed a handy Capella feature where you type a semicolon to have Capella automatically add a dot to the note entered next and then cuts the lenght to the half value for the following note and automatically revert the length to the value set before the semicolon feature. When I suggested to implement a similar feature I sadly didn't meet any Musescore user that shared my opinion that this is usefull.

To come to an end, I'd love to have the opportunity to assign a key shortcut to virtually every Musescore function. I realize that one could run short of available keys but this topic had been discussed before in a seperate thread.

In reply to by SlyDr

No need to defend one's custom shortcuts - that's what the feature is for! But do keep in mind that certain combinations like Ctrl+P are handled specially because they are reserved for standard OS functions, and hence can create problems.

For adding articulations note by note, sorry, I thought you had said you wanted to apply the same one to all notes in a passage, which is why we were suggesting simply doing a selection first. If it's different articulations for each note, easiest is to enter then while entering the notes. But if for whatever reason you have lready entered the notes and then wish to go back and add articulations, then indeed one note at a time is the way to go. To me, needing to hit the cursor key does not seem like a hardship, and as often as not I do not want to move on to the next note after applying an articulation, so actually losing the focus on the current note would be a step backwards. But if your workflow is such that it would be advantageous, by all means, keep experimenting with the macros!

I do agree that a simpler way to enter dotted rhythms would be useful. The trick is coming up with a way of doing this that works within the way MuseScore does things, so it feels natural to MuseScore users and not just to people accustomed to other programs that have an entirely different use model. Definitely worth continuing to discuss that in another thread.

As for assigning shortcuts to every function, that is our goal as well, and actually most of the work for this is already completed for the next major release, although that's still quite a long ways off.

In reply to by Marc Sabatella

I think I have posted elsewhere, but spotting this I thought I'd record my success with autohotkey. I use it for:
dotted keys (eg '5' whilst holding down'.' key), rest keys ('5' whilst holding down'0' key)and I have also used it for temporary shortcuts for common key phrases encountered in certain music. Finally I have used it for converting F1-F12 keys into ABCD... keys - useful when entering music in complex keys.

It's simple, but not trivial, to setup the scripts; it greatly improves productivity entering onto notations

In reply to by Marc Sabatella

For this purpose I'd consider it helpful to have separate shortcuts e.g. to switch note entry on and off instead of only one to toggle. This would make scripts independet of the current state.
A means to modify the length of the currently selected note could also be of help. This would make it possible to type in a melodic line and apply a rhythmic pattern previously recorded later.

In reply to by SlyDr

An interesting point. Certainly it would help if applying a rhythmic change to an existing note preserved the pre-existing pitch, rather than changed to default pitch. By the way a quick shout-out for the (now not so) new facility to enter rhythm and pitch separately. Great improvement to workflow!

In reply to by SlyDr

? You already can change the duration of the currently selected note - just click the appropriate button / use the appropriate shortcut. But this in no way addresses the infinitely harder problem of applying rhythm afterwards, because now you are talking about not only changing duration of a note, but applying some sort of algorithm to guess how many subsequent notes you might want moved earlier or later and then to do the cut and paste, also to guess whether you want this applied to other voices, etc.

Also, changing duration of a note does keep the existing pitch, not sure what you even mean about "default pitch" - there is no such thing, except in the "rhythm" entry mode.

In reply to by rl347

If you want a shortcut for the Rhythm mode you need to look for "Enter durations with a single click or keypress." Someone thought it was a good idea to explain the input modes rather than naming them the sames as the toolbar option in the shortcuts tab.

In reply to by mike320

Thx MIke, I use the standard shortcuts (3,4,5,6, 7 etc), plus A B C D E etc for pitch. My autohotkey shortcuts are more about entering a dotted note or a rest more simply - some would say three key entries are simple enough (eg . 5 . but I am a lazy devil)

In reply to by rl347

It is possible that there is an easier way to achieve your goal if this is for a specific score. If you're just trying to customize it to work like another program, it seems that is not currently possible. What is possible (though not definite) is that a macro capability will be added in the future based upon some work done last summer in GSOC.

If this is for a specific score, uploading a picture of the score or a sample measure would enable me or someone else to give you tips to make it easier.

In reply to by mike320

Thanks for your interest Mike. My need is general - I enter music to help me learn choral parts and my autohotkey changes make that process smoother and quicker. It works, there is the odd minor glitch, but it is fine. Sure, as a developer I can see ways of making it a little easier - and certainly a proper flexible macro language would help. I mentioned it just to make others aware of the possiblity. I've done that, so I guess we can consider this topic closed.

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