Closing export labels dialog from script

I have a script that opens a .wav, calls sound finder and then export labels. My problem is that I don’t know how to close the export labels dialog from the script. Does anyone know how to do this?

What sort of script?
What is in the script?

Sorry for being cryptic.

I started with the python pipe_test.py script and added the following lines.

do_command("Import2: Filename=“myfile.wav”)
time.sleep(2)
do_command(“SelectAll:”)
time.sleep(2)
do_command(“SoundFinder:”)
time.sleep(2)
do_command(“ExportLabels:”)

This runs but leaves me with an open “save” dialog which I can close from the UI but I would like to be able to close this dialog from my script.

My goal is to loop through a series of .wav files, creating a label file for each, ideally with each label file having the same name as the .wav file.

The “ExportLabels:” command does not export labels, it just opens the Label export file browser (as you have observed).
Audacity does not currently provide a command for exporting labels, but it does provide a command that allows you to get the labels:

"GetInfo: Type=Labels"

This returns the labels as JSON, which you can then parse and save in whatever format you want.

Thanks, I can work with that!

Note that pipe_test.py was updated yesterday to fix a bug. The latest version is here: https://raw.githubusercontent.com/audacity/audacity/master/scripts/piped-work/pipe_test.py