How to add quotation marks around message as file path

wiccy's icon

Hi guys,

I use [thispather] to print out the current working directory. It will include quotation marks to deal with folder with whitespaces. But then I use [sprintf] to combine the path with the actual filename I want to load. The resulting message does not have the quotation marks anymore. This is problematic for path with whitespace. According to the documentation, the solution is simply to add the quotation marks to the path.

I check the forum there is a suggestion of using javascript. I do wish to do that as I do not want to add additional file to the path. My intuition is to use [regexp] but my knowledge in regular expression is quite poor. Can you advice a pure max solution to add quotation marks around any given message ?

Thanks

Source Audio's icon

sprintf symout %s/bla bla
results in
"path/bla bla"

pdelges's icon

tosymbol can be very usefull when dealing with spaces in symbols.

Peter Ostry's icon

Where a single [tosymbol] or [sprintf symout ...] does not work, you can use escaped quotes in sprintf: \"
[sprintf list elements 1 2 3 or your text \"some text\" incoming string \"%s\" and numbers as text \”1 2 3\"]


wiccy's icon

Thank you for all your responses. They all work great. I particularly find simply using the character escaping to be quite bulletproof.

Thanks.