Forums > MaxMSP

filepath and quotation marks

March 13, 2006 | 5:00 am

Is there a particular reason that filepath will not work if the path is surrounded by quotation marks and it does not have a space in it? I am just bummed that I have to build a conditional to test whether or not the path contains a space before I enclose it with double quotes.

Thanks in advance.

Greg Cornelius


March 13, 2006 | 6:47 am

I think that I solved the problem. It had something to do with my use of quotes in sprintf.

I was using sprintf to add subfolders to the path, and I got greedy and had placed append in there as well. To compensate for the added append, I added quotes around the path. This worked fine except when the path did not have a space in it.

Example:

sprintf append "%sabs/"

instead of

sprintf %sabs/

going into

prepend append

Maybe this will help someone else out.

Greg


March 13, 2006 | 9:31 am

The problem is not limited to the filepath object. It’s a general
issue with symbols in Max. If quotation marks enclose a string of
characters containing at least one blank, the quotation marks are
interpreted as meta-characters delimiting the string (and overriding
the blank as a delimiter). If there are no blanks between quotation
marks, they are interpreted as literal characters, part of the string.

I have no idea why things were originally built this way, and I’ve
never heard an explanation from either David or Miller about the
logic behind the approach. It has confused untold thousands of Max
users. But changing it now would cause even more confusion and chaos,
so best to get used to it.

– Peter

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine | +–> Litter Power & Litter Bundle for Jitter
|…………………………………………….
p@castine.de | iCE: Sequencing, Recording, and Interface Building
pcastine@gmx.net | for Max/MSP
pcastine@bek.no | http://www.dspaudio.com/ Extremely cool
4-15@kagi.com |…………………………………………….
| home|chez nous|wir|i nostri http://www.castine.de/


March 13, 2006 | 10:32 am

in fact it should be :

sprintf %sabs/

going to

tosymbol

going to

prepend append

The tosymbol object will add the double quotes if necessary.

Best,
ej


March 13, 2006 | 10:45 am

Note that the documented "symout" argument to sprintf works now, as of
Max 4.5.7, so the tosymbol object shouldn’t be necessary.

jb


March 14, 2006 | 8:53 pm

Gregory Cornelius wrote:
> Is there a particular reason that filepath will not work if the path
> is surrounded by quotation marks and it does not have a space in it?
> I am just bummed that I have to build a conditional to test whether
> or not the path contains a space before I enclose it with double
> quotes.

If you consequently create the quotation marks with [tosymbol] it will
take care of it.

Stefan

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09


Viewing 6 posts - 1 through 6 (of 6 total)