Assigning scripts/macros to keyboard shortcuts?


inverted the slashes to no awail :blush:

A. Which context (kGlobal, kEditable etc.) did you put the key command in?
B. When you run the key command, does Run Script appear on Edit > Undo?
C. Do you really need the script at all? Wouldn’t it make more sense to assign the key command to do whatever the script’s action is?

A. in kGlobal near “Script.StartRecordingMacro” : [ “Ctrl+Alt+Shift+W” ]
B. no
C. there is no key command for Dead note

C. Click the link at the very top of this thread. Read my instructions on that thread. They tell you how to record a script and then inspect it in order to see what Dorico’s actually doing behind the scenes. They then describe how to take that function and graft it into your keycommands file with an appropriate shortcut, thus creating a shortcut for something that isn’t officially assignable.

Turning the dead key property on looks something like this:

It’s the pink bit that you need to graft into your keycommands file.

I know how to graft a function into my keycommands file, have done it often.

what I try here, is to follow Alexander Plötz’s method (post #2 of this thread)
the goal is to trigger “DeadNote.lua” that is in my scripts folder

You appear to have an extraneous " before C:. Try removing it.

Thanks Alexander

I finally made it working…
something was wrong in the path… :nerd:
thanks to I could validate my way thru

thanks Alexander, Leo and DanKreider


I tried to do that, pasted code before my first key command line (I think syntax is ok). When I run Dorico no key command (custom or default) works. i erased the code pasted and it works again. So I think I’m pasting it in the wrong context. Should I paste in kglobal, kwritemode or kmusiceditable? Or maybe is it a problem completely different?

Miguel, what are you trying to insert into your Keycommands file? The relevant context depends on what the function is.

I want to assign a key command to a macro file. It’s a test macro called ‘4x4_+10b_allegro’, that’s it:

local app=DoApp.DoApp()
app:doCommand([[NoteInput.CreateTempo?Definition=Allegro moderato q = 120&UseLocalOverride=0]])

Then I copied this code:

		"Script.RunScript?ScriptPath=MYPATH/systembreak.lua" : [ "Ctrl+Return" ]

I rooted to my macro:

		"Script.RunScript?ScriptPath=E:\PROYECTOS\DORICO\MACROS\4x4_+10b_allegro.lua" : [ "Ctrl+Num+0" ]

I copied before the first custom key command in the appdata ‘keycommands_es’:

	"common" : {
		"contexts" : [
				"context" : "kGlobal",
				"shortcuts" : [

						"Script.RunScript?ScriptPath=E:\PROYECTOS\DORICO\MACROS\4x4_+10b_allegro.lua" : [ "Ctrl+Num+0" ]
						"Edit.BeamTogether" : [ "Ctrl+Num+1" ]

When I saved it, key commands stopped working and they worked again when I erased this entry. I achieved to create a new entry in the keycommands_es working correctly in Dorico, as you explain in your link.

In appears this error:

Error: Parse error on line 9:
...s": [					{						"Script.RunScript?Sc
Expecting 'STRING', '}', got 'undefined'

But I don’t understand it because it has the same format than the rest of the key commands.

had almost the same parse errors etc See earlier in thread

what saved me is
first enter the alexander plotz line as is
validate it in json
then in json
slowly replace path chunks one after the other
replace another chunk
until you have entered and validated the complete line
then select all and replace in your json file
then it worked in Dorico
I cannot really say what made it work finally

Thank you SeeWhat! In my case, I replaced back slashes by fwd slashes in the path and JSONLint validated it without last comma (then added it). It works!

		"Script.RunScript?ScriptPath=E:PROYECTOS/DORICO/MACROS/4x4_+10b_allegro.lua": ["Ctrl+Num+0"]

It seems that JSON has some issues with back slash. Mac users don’t have to know it but Windows users do.

To assign a script at a particular path in Windows, to get valid JSON, you have to put DOUBLE backslashes in your path, like this:


The additional backslashes “escape” the second backslashes and make them valid, which makes valid JSON.

I learned this just now via trial and error.

1 Like

Reading from the open we see the link:
Thanks to Leo and Daniel for their awesome guidelines on this thread.

This link is dead. Can anyone help to find the link, please?

Hi @johnabram do you mean creating a macro: a KC to execute multiple KCs in sequence?

I’m not a Cubase user, so I can’t answer that.

I was just saying as in Cubase. I just removed it. I just rephrased it!
I suppose one way would be using Applescript to write a workflow on Mac.

Sorry, I’m very late; my attention’s just been drawn back to this thread. I suspect the broken link should resolve to Dorico 3 - Keyboard shortcuts for microtonal accidentals? - #5 by pianoleo

1 Like