MACRO to go to specific track, perform operations, go to next track, etc

It’s embarrassing to be hung up on something so seemingly simple. All I want to do is start at the first track, perform an operation on the clip, move to the next track, perform and operation on the clip, etc…

Move Focus to First Track
Cursor to Track Start
Select Cursor to Track End
(perform operations)
Move Focus to Next Track
Cursor to Track Start
Select Cursor to Track End
(perform operations)

What happens is all the operations get performed on the single clip in the track where my cursor happens to have last clicked on. (if my cursor is in the fourth track, all the operations are done on that fourth track) Apparently putting ‘focus’ on a track is not enough. You apparently have to ‘select’ that track? Then the cursor goes to the start of the track with focus?

Audacity 3.3.3 on Win 11

Yes; the documentation for Macros is clearly lacking. Try Extra > Focus > Toggle Focused Track. @waxcylinder

The documentation for Scripting commands is largely generated automatically. Additional documentation written by a human would be a beneficial. Note that @waxcylinder is a volunteer contributor, and now that Audacity is owned by a commercial company, responsibility for providing documentation lies with the Audacity Team management.

For many years I too was mightily puzzled as to the difference between “Selection” and “Focus”.
But I always knew that Selection was what one needed for most operations (same is true in other
audio and video editors I use, along with Word and Excel) - and that Focus was somewhat secondary
and limited in its scope.

So I did some research (with Steve and Gale RIP and others) and wrote up a passage on the Selecting
Audio page about the difference between the two:

Where it says:

This is clearly linked two from the custom TOC (Table Of Contents on the page.

Personally I have never found Focus to be any use at all (but apparently it can be of use to VI users
though how they see the yellow border is a mystery to me). I would actually prefer it if we didn’t have the
concept of focus - but I don’t think it will go way anytime soon if ever.

Obviously from :@jademan 's post some users can still get confused thinking that focus is more powerful
and useful than its limited use is. So I can consider adding a Tip div in the Macros (and maybe Scripting)
documentation re the importance of selection - and add a link to the above section on the selecting
audio page.

But remember that Macros and in particular Scripting are somewhat advanced features of Audacity and
are really intended for experienced and knowledgeable users - and one would reasonably expect such
users to understand the need for, and the uses of selection as it is fundamental to the use of Audacity.


1 Like

If I understand correctly Muse’s long term plan is to have all the uses of Audacity stuff moved over into their GitHub book, their “Support” site:

Some things have already been moved there from the manual, for example FFmpeg installation.

This will leave the Manual ultimately as a pure reference manual describing the various menu items, prefs setting and effects etc. This is why I restructured the Manual a few releases ago so the the old fromt page eas divided into three sections:

  1. The Reference section - this acts as the landing page
  2. How to use Audacity
  3. Tutorials for Audacity.

I, as a part time volunteer, endeavour to keep the Manual as up to date as possible - but I suspect that once the GUI changes with the Qt conversion I am likely to be unable to keep up with such major changes (I struggled recently with the Export dialog changes needed for the upcoming 3.4.0 as that involved editing a very large number of pages).


1 Like

@steve @waxcylinder Thank you for your comments. Audacity would not be the same without your contributions! :grinning:

OK so I’ve had a look at the Macros pages and “Selection” looks pretty clear to me

On this page you will see:

And the page has a clear entry in the custom TOC for “Selection”

I’ve always thought that Macros were sufficiently tricksy that users f them would benefit from RTFM (I certainly had to when I started using 'em)

How much cleared do you want it to be ?


Thank you. :grinning:

And the top-level landing page for Macros
has this

I can draw attention by bolding the “Select” words - but otherwise it looks clear enough to me.


1 Like

And the third (and final) page on Macros - about the Macros Palette

has this already:

All looks clear to me on all three pages with regard to selection

The underlying problem is that some users can get confused between “selection” and “ficus” - but I find it hard ti mitigate that - - nor can I make users RTFM


1 Like

There is a confusing issue in the scripting reference(Scripting Reference - Audacity Manual)

When the Parameter description says " (default:unchanged) ", I think what it really means is: “Not changed by the code that calls the command”.

If we take a fictitious command as an example, let’s call it “Foo”, and it takes one optional argument “Bar”, then the auto-generated documentation might say:

Scripting Id __ Action _________ Parameters ______
Foo: ____ Does foo. ____ bool Bar (default:unchanged)

We might assume that if Bar is not enabled, then whatever Bar would effect if Bar were used, is not changed.
Unfortunately that may not be the actual case.

Even though the scripting command ignores Bar when Bar is not enabled, the actual behaviour depends on the default behaviour of Foo (the command that runs when calling the scripting command Foo:).

Now let’s take an actual example:

Scripting Id __ Action _________ Parameters ______
Select: ______ Select… ____ double Track, (default:unchanged)

The act of calling the scripting command Select: without enabling the Track parameter, falls back to the default behaviour of the “Select” code, and the default behaviour is that it applies the selection to the first track.

The wiki script that automates the documentation does not know the implementation details of the commands in Audacity, so when a parameter is ignored, it assumes that the thing that the parameter refers to will be “unchanged”. Due to implementation details in Audacity, that may not be the case - the actual effect depends on how the command is implemented in Audacity.

Another change that could be made is to change the name of the “Toggle Focused Track” command to “Select(Unselect) Focused Track”. Perhaps this should be an Enhancement request.

I’m afraid that Scripting is way above my pay-grade - and well out of my bailiwick :wink:

That’s something you may need to take up with James Crook


I have worked through all three Macros pages in the 3.4.0 alpha manual and bolded references to “Selecting” where I think appropriate - and helpful (where they may aid understanding). And in most cases added links to the Selecting Audio page.

I have also tweaked a few bits of page layout to make the reading a little more digestible.

There’s always room for a little polishing …


Peter, this is very helpful. By discarding ‘focus’ and using ‘select’ and ‘set’ I’m able to freely navigate around my project.



1 Like

Glad we got you sorted Bob.


Rustic 20 /OP

Thanks for starting this topic. I went through the thread, but unable to discern / infer (from the posts) whether you were able to write a macro for doing this.

I am quite interested in the solution as-is as well as using it as a seed for building on it for other similar functions.

Thanks in advance Sri.

My first plan was to go to the first track, perform operations, go to second track, perform operations, go to third track…. Etc., etc.

01 Select Tracks Mode=”Set” Track=”0” TrackCount=”1”
02 Select Track Start to End
03 (Perform your operations)
: (Perform your operations)
: (etc.)
10 Select Tracks Mode=”Set” Track=”1” TrackCount=”1”
11 Select Track Start to End
12 (Perform your operations)

Note how Track=”increments from 0 (first track), to 1 (second track), to etc…”

While this worked it was cumbersome. Looping is not available, condition checks (are you at last track?) is not available…. Etc.

So, what I elected to do was import one track at a time, do my work, then export that track and import the next.

01 Select Track Start to End
02 Stereo To Mono
03 thru 0x Filter Curves, Normalize, etc. etc.
11 Export as WAV
12 -END-

With your MACRO Manager open you select your Macro then at the bottom of the MACRO Manager there is a button labled ‘Files…’. Open it, select the audio files you want to work on, select ‘Open’ and Audacity sucks in the first file, operates on it and ‘Exports’ the result. Then, sucks in the second file, operates on it and saves the result. Then, …… etc.

Using this method I finished over 700 audio files in a little over two hours.