Help with scripting

I am trying to script the following but not having any luck.

Two tracks are loaded…we’ll call them Track1 and Track2, with Track1 being at the top and Track2 below it. Here is what I want the macro to do:

  1. Select all of Track2
  2. Store Position of all of Track2
  3. Apply that Stored Position to Track1

I can’t seem to figure out what script commands to use to do this. Any help is appreciated!

Thank you.

OK; got that…

(This is the sound of me scratching my head).

Perhaps you want to post illustrative screen shots showing the current situation and your desired result ?

Sure thing. Here are the manual steps I would like to put into a macro.

Here are my two tracks…Track01 (top) and Track02 (bottom).

I then select all of Track02.

With all of Track02 selected, I then click Select → Region → Store Selection

Next I place the cursor into Track01, then I click Select → Region → Retrieve Selection and as you can see below, the stored selection from Track02 is applied to Track01.

I can’t seem to find a macro command that selects all of Track02. This is what I have at this point, which is not working.

image

Thank you!

Yes; Try this:

SelectTracks:Mode=“Set” Track=“1” TrackCount=“1”
SelTrackStartToEnd:
SelSave:
SelectTracks:Mode=“Set” Track=“0” TrackCount=“1”
SelRestore:

1 Like

That worked great…thank you!

Now I’d like one more step added, and that is to save the retrieved selection to a WAV file, but, ideally, have it prompt me for a file name and path, or at least a file name. I tried inserting “Export As WAV” to the end of the macro, and it saves it to the C:/Users/< username>/Documents/Audacity/macro-output/ folder. Is there any way to set the output to a different folder name?

Try Edit > Preferences > Directories > Macro Output

1 Like

Thanks…that will do just fine.

One more question…is there a way to have the macro output (eg. exported files) go to the root of a folder instead of always going to a folder called “macro-output” ? In other words, as an example, in Preferences I have the Macro output directory set to C:\Custom_Stuff and when I export using a macro, the output goes to C:\Custom_Stuff\macro-output. Is there a way to just have it go to C:\Custom_Stuff\ ?

I guess not.