Using macros how to avoid online prompt when closing a project

Hi All,

Is it possible to avoid manual input of No/Cancel/Yes while closing a project using Macro “Close:” command?

Tried 'Close: “Mode=No” ’ with no effect. What parameters to be provided to Macro Close command to close a project with No/Cancel/Yes input to eliminate manual interactive input

thanks in advance

According to the Scripting Reference, there are no parameters for the close command:Scripting Reference - Audacity Manual

Also note, “A few commands are intentionally omitted from the Macro Manager (such as ‘Close:’) because they are unsuitable for use in Macros.”

That’s the important part.

The command Exit: is available, though this should probably have been excluded also as it encounters the same problem as Close. The problem is that macros run in the context of the current project. If a macro attempts to close the project, the project closes while the macro is still running, which inevitably causes a crash (processes need to be properly exited before the project can cleanly close).

On the other hand, both Close and Exit may be used when executing scripting commands from Python. This works because Python is running independently of the Project context. However there are still a couple of considerations:

  1. The project should be saved first, so as to avoid being prompted to save. (If you don’t want the saved project and you want to conserve disk space, delete everything from the project first so that you are saving an empty project).
  2. If a new instance of Audacity is launched, the pipe connection between Python and Audacity must be re-established, as the previous pipe was disconnected when Audacity closed.

Yes I’m using python Close: and yes Close: seems to be doing what I think it is, namely removing temporary files, and references to undo, but the application’s manual prompt request of input of No/Cancel/Yes even after export is the issue which is not letting me continue on a bunch of files.

Thanks a lot to Steve & Jademan for your prompt response and replies, I appreciate it but as can be seen above it still does add up why a close following export is providing the manual prompt request of input of No/Cancel/Yes, and b) if Close: does not take parameters & If I have already exported it, then how would one go about this?

thanks again in advance for your time and help. appreciate it sir

Try sending a valid " SaveProject2:" command before “Close:”.

thanks again for taking time and making constructive suggestions, I really appreciate it Steve. you are very helpful sir.

although SaveProject2: is an interesting suggestion and possibly may be a work around, unfortunately SaveProject2: would overwrite the original which i’m not allowed hence was using export.

May be I can make a copy of the original to a temp location, work on the copy, export to destination plus save can be done. Since export is not being recognized as save, I will do this circular approach to verify if it satisfies the save and report back sir … I just need some time to get this set up in a temp location and do it sir. I will let you know sir

thanks again for your time and efforts

The SaveProject2: command requires a Filename= argument, which must be set to a valid file path. The filepath tells Audacity where to save the project, so as long as it is not set to the same location as the original project then there’s no problem.

As you don’t actually need the saved project, you could save it to the system’s temporary directory so that it can eventually be deleted by the system (assuming that your operating system supports automatic cleaning of its temp folder). To save disk space, you could delete all tracks in the project prior to saving, but to do this you will need to disable the warning about saving an empty project.

This topic was automatically closed after 30 days. New replies are no longer allowed.