Forums > MaxMSP

text object question

December 2, 2008 | 8:30 pm

is it possible to use a specific search path in a read / write message to a text file?

like: "read ……/Desktop/Files/file.txt"


December 2, 2008 | 8:40 pm

Send "read" or "write" followed my an absolute path, enclosed in "quotes" if it contains spaces, to the [text] object. For example:

read "Macintosh HD:/Users/myname/Desktop/filename.rtf"
write "Macintosh HD:/Users/myname/Finances/lotsamonies.csv"

lh


December 2, 2008 | 9:16 pm

what if I don’t know user name?
let’s say I have a patch in applications… I want to write a text file to be placed on desktop, on every computer that runs my patch…


December 2, 2008 | 9:49 pm

You could try banging [thispatcher] or using javascript to get the location of your patch and then [regexp] the path to find the username and then format the path to the desktop from there. That would work on a mac, as long as your patch was not loaded from somewhere outside of the user’s space on the hard drive. I’m not sure about using this method on a windows machine.

Actually on a mac you could just use applescript with Bill Orcutt’s [shell] external.

lh

– Pasted Max Patch, click to expand. –

December 2, 2008 | 9:56 pm

thank you!


December 2, 2008 | 11:03 pm

hi,

[getpath] for Mac OS X) or [getenv] for Windows
will give you the user paths (and many others).

both externals can be found in my collection here: http://www.jasch.ch/dl/

hth

/*j


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