Does anyone know how to add the Select All command (Ctrl + A) in a Nyquist script?
If you’re writing a “normal” Nyquist plug-in (rather than a “Nyquist Macro”), then it is not possible to modify the selection. Nyquist can only access audio that is selected at the time that the effect is launched.
If you’re writing a Nyquist Macro, then it’s: (aud-do “SelectAll”)
Example script that may be run in the Nyquist Prompt:
;type tool (aud-do "SelectAll") ""
Thank you. The following is a script for adding labels which you had given earlier. In order for this script to run properly, all tracks have to be selected first.
Where should the command (aud-do “SelectAll”) be added in the script so that all tracks may be selected before the other commands in the script are executed?
(setf id 'track-labels_2019-05-09_23:17:39) (defun new-label () (list (get '*track* 'start-time) (get '*track* 'name))) (defun add-label (labels) (push (new-label) labels)) (if (get '*scratch* id) (let ((labels (get '*scratch* id))) (putprop '*scratch* (add-label labels) id)) (putprop '*scratch* (add-label ()) id)) (if (= (get '*track* 'index)(length (get '*selection* 'tracks))) (let ((labels (get '*scratch* id))) (remprop '*scratch* id) labels) "")
That can’t be done in a normal Nyquist plug-in.
As I wrote previously: “Nyquist can only access audio that is selected at the time that the effect is launched.”.
If there’s only one track selected when Nyquist is launched, then that’s the only track that Nyquist can see.
The way that you could get it to work would be to create a Macro (see: https://manual.audacityteam.org/man/macros.html)
In the macro, you would use the command “SelectAll:”, and then a command to run your Nyquist script.
There are two ways that you can run a Nyquist script in a macro.
- One is to make the script into a “plug-in” (see: https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference) and install the plug-in. You can then include the plug-in in a Macro in the same way as you would any other effect.
- The other is to use the command “NyquistPrompt:” in the macro, and put your Nyquist code into the Nyquist Prompt.
Thank you. This is a good solution. The window for the creation of a macro has the Select All command, which can be executed before running a script.