I am trying to time shift a selected track using scripting commands in Python, ideally the shift would be for a given number of ms.
I am selecting the time shifting tool and then what ?
Here is my main code (the do_command() works fine) :
I don’t think it’s possible to do “mouse drag” from Python, so you need to approach this a different way.
If you want to move a clip to the right, make a selection to the left of the clip (or at the start of the clip) and duplicate it. If the original selection was empty space, then you’re done. If the original selection was audio, then go back to that selection and silence it.
To move a clip to the left, just make a selection to the left of the clip, and delete it.
Step to is the “Repeat effect” https://manual.audacityteam.org/man/repeat.html and that will shift the track to the right by “x” ms.
The final step may be either the Silence effect, or “Split Delete” or “Split Cut”. The former will leave “x” ms of silence at the start. The latter 2 will leave “x” ms of empty space at the start.