Quotes in scripting filename

I’m using the Import2 scripting function. I just found a bug in my script where a track didn’t open. The filename included “xxx (12” version)".

The problem is that the double quote on 12" terminates the filename string. I could quote the filename using single quotes but that will only move the problem.

I’ve tried escaping the double quote with a backslash but that didn’t work.

How can I passed an embedded quote character to Import2?

Thanks.

I’ve just tried Export2 in a macro (on Linux) and it works for me, not that I’d ever use a double quote in a file name. Even though Linux allows the double quote character, it is generally considered bad practice.

I don’t like a double quote in the filename either, but sometimes these things are out of our control.

The command I’m sending is:

Import2: Filename="{path}"

It’s clear that an embedded double quote will prematurely terminate the path so I’m looking for a way to embed it. I’m not sure that an Audacity macro is helpful for remote control, but maybe I’m missing a trick somewhere.

Of course I could replace the double quotes with single quotes, but that will cause issues with filenames with a single quote embedded.

Thank you for your answer.

How are you sending the commands?
I’ve just tested with the pipeclient.py CLI app and it works as expected when escaping the double quote with a backslash:
Export2: Filename="/home/<my user name>/Desktop/export\"ted.wav"

Thank you. My mistake - in my testing, I ended up encoding the string twice. Sorted now.

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