Closing the project from macro

Questions, discussion and recipes for scripting and batch processing in Audacity.
See also the "Scripting" section of the Audacity manual.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Msv264
Posts: 13
Joined: Mon Apr 05, 2021 8:08 pm
Operating System: Windows 8 or 8.1

Re: Closing the project from macro

Post by Msv264 » Mon Apr 12, 2021 4:50 pm

Yes, I understand.
But if you look into the manual, it includes text:
A standard File Open dialog box will appear. Choose a directory then you can select one or any number of supported audio files in that directory, including Audacity AUP3 :?: :?: :?:
That is, Manual supposes, that you can select aup3 files in the dialog, where files for batch processing are selected.
Which is clearly not true.
The link to the page is
https://alphamanual.audacityteam.org/ma ... acro#Files

Msv264
Posts: 13
Joined: Mon Apr 05, 2021 8:08 pm
Operating System: Windows 8 or 8.1

Re: Closing the project from macro

Post by Msv264 » Mon Apr 12, 2021 4:58 pm

Here is the foto of the manual page.
Attachments
Screenshot_2021-04-12-19-56-37-631_com.android.chrome.png
Here is the foto of the manual page
Screenshot_2021-04-12-19-56-37-631_com.android.chrome.png (435.25 KiB) Viewed 222 times

waxcylinder
Forum Staff
Posts: 14658
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Closing the project from macro

Post by waxcylinder » Mon Apr 12, 2021 5:16 pm

Good catch Msv264, many thanks :) 8-)

I've fixed that:
https://alphamanual.audacityteam.org/ma ... acro#Files...

I was going to take out the reference to AUP files and leave that as a total "easter egg" - but I decided to leave it in (for now at least).

It also "nudged" me into noticing a couple of other corrections that were needed. And luckily it will make it into the 3.0.2 manual as we found a P1 bug today that will need fixing and a new Release Candidate - and thus a fresh pull of the Manual.

Thanks, very much appreciated,

Peter.
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Msv264
Posts: 13
Joined: Mon Apr 05, 2021 8:08 pm
Operating System: Windows 8 or 8.1

Re: Closing the project from macro

Post by Msv264 » Mon Apr 12, 2021 5:57 pm

;)

Msv264
Posts: 13
Joined: Mon Apr 05, 2021 8:08 pm
Operating System: Windows 8 or 8.1

Re: Closing the project from macro

Post by Msv264 » Tue Apr 20, 2021 8:23 pm

Hello.
I am sorry to bother you again, but I still can't solve the problem.
I tried to use Python scripting but it seems the "Close" command doesn't work from script too. Here is the program:

import os
import sys

TONAME = '\\\\.\\pipe\\ToSrvPipe'
FROMNAME = '\\\\.\\pipe\\FromSrvPipe'
EOL = '\r\n\0'

TOFILE = open(TONAME, 'w')
FROMFILE = open(FROMNAME, 'rt')

def send_command(command):
TOFILE.write(command + EOL)
TOFILE.flush()

def get_response():
result = ''
line = ''
while True:
result += line
line = FROMFILE.readline()
if line == '\n' and len(result) > 0:
break
return result

def do_command(command):
send_command(command)
response = get_response()

do_command("OpenProject2:Filename=\"D:\\Processing\\!01_07.aup3")
do_command("Close:")

TOFILE.close ()
FROMFILE.close ()
sys.exit ()

This program is based on the pipe_test.py that is supplied in manual.
Project opens ok.
When command "Close" is passed to Audacity, it just crashes.
I tried several files, different paths for file. The result is always the same.
I also tried to restart my PC - to no avail.
I enclose the Windows message with description of error (it in Russian, but the translation is very simple: "Program “Audacity…” doesn’t work.
Some problem caused program termination. Windows will close the program…").
Attachments
1.png
1.png (10.67 KiB) Viewed 144 times
2.png
2.png (10.1 KiB) Viewed 144 times

steve
Site Admin
Posts: 81226
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Closing the project from macro

Post by steve » Tue Apr 20, 2021 8:37 pm

"Close:" works fine for me with "pipeclient.py".

Note that "pipe_test.py" is only intended as a quick and easy way to check that mod-script-pipe is working.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81226
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Closing the project from macro

Post by steve » Tue Apr 20, 2021 8:39 pm

pipeclient.py is here: https://github.com/audacity/audacity/bl ... eclient.py
Documentation is in the Docstrings.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81226
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Closing the project from macro

Post by steve » Tue Apr 20, 2021 8:46 pm

Msv264 wrote:
Tue Apr 20, 2021 8:23 pm
"D:\\Processing\\!01_07.aup3"
I'm not sure if that was a typo, but you should avoid using special characters in file names (the exclamation mark "!"). Even if it is a legal file name (I think it is), I would not like to assume that the Windows Shell will be happy with it.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Msv264
Posts: 13
Joined: Mon Apr 05, 2021 8:08 pm
Operating System: Windows 8 or 8.1

Re: Closing the project from macro

Post by Msv264 » Wed Apr 21, 2021 3:53 am

"I'm not sure if that was a typo, but you should avoid using special characters in file names (the exclamation mark "!")."
I tried several different file names, it was just one sample.
For the file with another name (without '!' in the beginning) it crashes too.
About the pipe_test.py - I tried to modify it, to add some other commands, and it works fine.
I can open project, make some other operations, but not "Close".
But thank you for advice, I will try pipeclient.py.

steve
Site Admin
Posts: 81226
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Closing the project from macro

Post by steve » Wed Apr 21, 2021 9:48 am

Msv264 wrote:
Wed Apr 21, 2021 3:53 am
I can open project, make some other operations, but not "Close".
I've not tested, but my guess is that with "pipe_test.py", Python is hanging waiting for the response to the Close: command. If that's the case, then hopefully it's just because it is running in a single thread (which should be fixed by using pipeclient.py), but it could be a problem in the Windows implementation (I'm on Linux).

Try using pipeclient.py with the command line interface to see if Close: works (a quick and easy way to test).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply