Macro: How to make a selection relative to labels

I see from one of your other forum topics that you have Audacity 2.3.0.

I’d forgotten, but in Audacity 2.3.0 there was a problem with the formatting of the data from the command (aud-get-info “Labels”). This problem has been resolved in Audacity 2.3.1.

The code in my previous post is correct for Audacity 2.3.1, but requires a slight modification to work in Audacity 2.3.0.
For 2.3.0, change the line:

(setf labels (second (first (aud-get-info "Labels"))))

to:

(setf labels (second (aud-get-info "Labels")))