cubase ninja - pro tools-style trim automation macro

it’s the rest that has proven quite a challenge. anyhow, here’s the macro as best as i could tweak it thus far. there is still an issue, and i’m hoping you can help me fine-tune that one: if there are more automation tracks for the given channel, the PLE script (=the last step in the macro) selects all the automation events inside the range for all the automation tracks on the given channel. in other words, i need to write a PLE script that selects the automation events inside the cycle, but only on the track for the one parameter you are trying to trim.

(edit: you could actually see this as an added functionality… in that all the parameter automation on the given track in the given range gets selected, so you are free to make adjustments to more parameters. still, i am wondering if someone can make a 'select automation events for the parameter on the selected track in the selected range. no matter what combination of PLE commands i tried i couldn’t come up with one.)

–the macro:
edit - copy
edit - paste
transport - locate selection
transport - nudge -1 frame
edit - left selection side to cursor
transport - locate selection end
transport - nudge +1 frame
transport - nudge +1 frame
edit - right selection side to cursor
edit - copy
edit - paste
transport - locate selection
transport - locate next event
edit - left selection side to cursor
transport - locators to selection
tool - select tool
process project logical editor - “your PLE script to select automation inside cycle” (see below)

–the PLE script:
media type equals automation
position inside cycle PPQ
//
function - select