This is the tricky part: "first press: Select Track (assigned in binding focus)"
This is something I remember fixing recently so I don't know if it is in build 41. What it requires
is that the script know which track it is currently "in" when it runs. This is not necessarily the same
as focusedTrack since with binding scopes you can run the script in any track you select in the binding
without moving the focused track border in the UI. What you can do in build 42 is this:
SelectTrack(trackNumber)
Where trackNumber will be the number of the track the script is running in. I remember needing that for another request recently.
It might work to just do this:
SelectTrack
without an argument. This is working in build 42, not sure about 41.
#name AlexTest
#sustain 500
#repeat 300
SelectTrack
function OnSustain {
if sustainCount == 1 Replace
}
function OnRepeat {
if repeatCount == 1 Mute
}