I don’t think this script will work in the general case anyway, because the first command is a selection command that is wired to a specific pair of X/Y coordinates.
It seems that these two commands cannot be used in succession in the script. It may be a bug.
So in between these two commands, I’ve inserted commands to toggle the properties panel. I think this script works correctly.
local app=DoApp.DoApp()
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteHarmonicType&Value=string: "kArtificial"]])
app:doCommand([[Window.ShowBottomPanel]])
app:doCommand([[Window.ShowBottomPanel]])
app:doCommand([[UI.InvokePropertyChangeValue?Type=kNoteHarmonic&Value=int: 4]])