Inserting silence at specific time using mod-script-pipe

I’m using mod-script-pipe to control Audacity via scripting, and I’m trying to insert a 5-second silence at the 3.5-second mark of a track.

Here are the commands I’ve tried:
SelectTime: Start=3.5 End=3.5
Silence: Duration=5

The console returns “BatchCommand finished: OK” for each of the commands. However, the result is that the entire track is replaced with silence, rather than just inserting silence at the specified point.

Could someone please clarify the correct way to insert a 5-second silence using scripting?

Thanks in advance for your help!

When generating silence, you have to select the region that you want to be silent. That is, select Start=3.5 End=8.5 . That will of course overwrite the audio in that region, so before doing that you need to add 5 seconds of audio, which you can do with the Repeat command.

So the steps are:

SelectTime:End="8.5" RelativeTo="ProjectStart" Start="3.5"
Repeat:Count="1"
SelectTime:End="8.5" RelativeTo="ProjectStart" Start="3.5"
Silence:Use_Preset="<Current Settings>"

It worked perfectly, thank you!