lua script question

this script works

local app=DoApp.DoApp()
app:doCommand([[NoteInput.CreateBarRepeatRegion]])

this one also

local app=DoApp.DoApp()
app:doCommand([[UI.InvokePropertyChangeValue?Type=kGenerativeBarRepeatNumberOfBarsToRepeat&Value=k2]])

but both together only the first works

local app=DoApp.DoApp()
app:doCommand([[NoteInput.CreateBarRepeatRegion]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kGenerativeBarRepeatNumberOfBarsToRepeat&Value=k2]])

Any idea?

Claude

Do you need to select the Region first?

yes select first then launch the script

I don’t know the answer but this sequence also involving Note Input and the UI also works individually but not together.

I notice you both have Stream decks. Isn’t there a way to do it using that?

I use Metagrid (very similar) and I would use a key command for one and a Macro for the other. Is that doable for you?

For that particular job, I think automating the typing of Shift+R %2 Return using something like AutoHotKey is going to be more productive than trying to do this via scripting.

Damn I keep forgetting to use the pop-over

thanks Daniel

Thanks TopDots - yes, I have a StreamDeck and Metagrid which I use all the time. Your method is the one I’d normally use. I was just puzzled as to why the macro wasn’t working.

Hi,
I do have a similar problem with scripts, but more related to my workflow. I use 2 monitors, bigger and lower for editing, a smaller and upper for controlling. In Dorico my basic setup is Write on editing lower monitor and Play on controlling upper monitor. However I quite often switch them to correct velocities or CCs, so I get Play on lower monitor and Write on the upper. I have tried to record two macros to have this switching back an forth easy, even thought of adding a shortcut to it, but the script applies commands without switching the monitors. I checked the script and it does not differentiate between windows. In consequence whatever the script contains is applied to a window that is active at the moment. I also did not find any function allowing for moving focus from one project window to another.
Any smart ideas how to make it work the way I wanted?
Every help here will be most appreciated.
Witold

Unfortunately there’s no command in Dorico to move the focus to the next window, so there’s no way to script this directly using Dorico’s own macro recording. You’ll need to use an external application like AutoHotKey or Keyboard Maestro, I think. Perhaps you can set up an AHK or KM macro that runs a specific Dorico macro, then switches the focus using the OS capability, then runs a second macro?

Daniel,
Thanks for quick reply. This is not a problem of a high magnitude, more like removing a small inconvenience. Looks to me that using the solutions you suggest may be too serious for such a small hiccup. Nonetheless I really appreciate your help and will continue to try to find my own workaround. If I find something making sense I will publish it here.
Witold