Only Running Part of My Script

I made a little script to change notes to stemless slashes by recording a macro, when when I run the script only part of it runs.
It’s as follows

local app=DoApp.DoApp()
app:doCommand([[Edit.SetNoteheadSetOverride?NoteheadSetEntityID=noteheadset.slashNoteheads]])
app:doCommand([[Window.SwitchMode?WindowMode=kEngraveMode]])
app:doCommand([[Window.SwitchLayoutAspectType?LayoutAspectType=kPageViewAspect]])
app:doCommand([[Window.ShowBottomPanel?Set=true]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteStemLengthDelta&Value=0]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteStemLengthDelta&Value=-11/4]])
app:doCommand([[Window.SwitchMode?WindowMode=kWriteMode]])
app:doCommand([[Window.SwitchLayoutAspectType?LayoutAspectType=kGalleyViewAspect]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteStemLengthDelta&Value=-11/4]])
app:doCommand([[Window.ShowBottomPanel?Set=false]])

It recorded everything I wanted it to, but the result is stemmed slashes, not stemless.
I’m not too familiar with the system. Any ideas?

The scripting support in the program is pretty rudimentary at the moment, so it wouldn’t surprise me if it’s not possible to completely automate this at the moment. However, I don’t think you need all of the steps you’ve got in your script above. You might be able to get away with this:

local app=DoApp.DoApp()
app:doCommand([[Edit.SetNoteheadSetOverride?NoteheadSetEntityID=noteheadset.slashNoteheads]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteStemLengthDelta&Value=-11/4]])

which are the two actual important steps.

Thanks for the streamlining! Unfortunately this has the same issue: it changes the noteheads to slashes but doesn’t touch the stems. It shows the console when it runs, but the console just stays blank, so unfortunately I have no idea what’s actually happening.

I suspect the issue is that something is not quite right with the selection after the initial operation, so the next operation doesn’t complete successfully. Scripting is both very rudimentary and also more or less unsupported at this stage, I’m sorry to say.

No worries! What I’m trying to simulate is ‘comping’ notation, in which a rhythm section player has bars filled with stemless slashes per quarter note.

I’m brand new to Dorico so I haven’t tried this, but is it possible to edit the length of the stems so that they would = 0 length, effectively disappearing and leaving only the slashes? Just a thought.