Does coll accept a filepath?

Jul 30, 2008 at 12:25am

Does coll accept a filepath?

Can I tell [coll] to automatically read a file from a folder? Help and reference mention only a filename but no filepath and I had no luck by specifying a path as an argument.

#39061
Jul 30, 2008 at 12:41am

On 30 juil. 08, at 02:25, Peter Ostry wrote:

> Can I tell [coll] to automatically read a file from a folder? Help
> and reference mention only a filename but no filepath and I had no
> luck by specifying a path as an argument.

“read yourHD:/yourFavoriteFolder/yourAmazingCollFile.txt” works fine
(without the quotes). If it doesn’t for you please post a example patch.

Best,
ej

#137008
Jul 30, 2008 at 1:19am

Thanks for the example, full absolute path starting from the harddisk works now. But can I have a relative path either?

This is the Finder hierarchy:
Interfaces (folder)
– Max to Logic (folder)
—- Max_Logic_1.maxpat
—- Preferences (folder)
—— ALS-Control-1.txt

A [coll] in the patch “Max_Logic_1.maxpat” should load the textfile from the Preferences folder. I tried
Preferences/ALS-Control-1.txt
and
./Preferences/ALS-Control-1.txt
but [coll] does not like these paths.

#137009
Jul 30, 2008 at 7:30am

On 30 juil. 08, at 03:19, Peter Ostry wrote:

> Thanks for the example, full absolute path starting from the
> harddisk works now. But can I have a relative path either?
>
> This is the Finder hierarchy:
> Interfaces (folder)
> — Max to Logic (folder)
> —- Max_Logic_1.maxpat
> —- Preferences (folder)
> —— ALS-Control-1.txt
>
> A [coll] in the patch “Max_Logic_1.maxpat” should load the textfile
> from the Preferences folder. I tried
> Preferences/ALS-Control-1.txt
> and
> ./Preferences/ALS-Control-1.txt
> but [coll] does not like these paths.

You need to construct an absolute path:
- send the path message to [thispatcher]
- construct the all path with [sprintf symout %s/yourSubFolder/
yourfile], where %s will be replaced by the source path, and the
symout argument takes care of the proper symbol generation (adding
double quotes if they are necessary).
- [prepend read] to put the “read” message at the beginning of the
message.

HTH,
ej

#137010
Jul 30, 2008 at 8:49pm

Quote: Emmanuel Jourdan wrote on Wed, 30 July 2008 09:30
—————————————————-
>
> You need to construct an absolute path:
> – send the path message to [thispatcher]
> – construct the all path with [sprintf symout %s/yourSubFolder/
> yourfile], where %s will be replaced by the source path, and the
> symout argument takes care of the proper symbol generation (adding
> double quotes if they are necessary).
> – [prepend read] to put the “read” message at the beginning of the
> message.
>
>
—————————————————-

Thanks Emmanuel for this tip.
I wish I found this some months early when I needed it ;-)

Combined with another great tip found in this forum:

“OK, here’s what I had to do: I’ve got all these sample files – instead of putting them in the same folder as the application, open the application as a package (in OSX, ctrl-click and select ‘Show Package Contents.’
From there, go to Contents: MacOS, and drop your files inside that folder.Your standalone application will now run fine, loading your files when necessary, while staying completely self-contained!”

This could be very handy.

BTW, here is the patch you describe with “read” and “save” to Coll:

– Pasted Max Patch, click to expand. –
#137011
Jul 31, 2008 at 4:44pm

Thank you Olivier for your example patch. I was completely lost as I read Emmanuel’s description but after I saw the patch the system was quite obvious. Many thanks also to Emmanuel of course!

One last question about the filepath issue:

Is it correct that filepaths are only needed to organize the stuff while developing because when I finally build the application everything will end up in the program folder anyway?

#137012
Jul 31, 2008 at 5:32pm

I am glad this helped.

hm, I think you will have to deal with path even with a standalone.
Objects still need to know what and where to load / save.
You don’t have to deal with path when the files you want to load are under Max’s Radar i.e “File Preferences”, if so you just need the give a file’s name to load it.

I hope I am wrong and someone will correct me, but I am not so sure.

Quote: Peter Ostry wrote on Thu, 31 July 2008 18:44
—————————————————-
> Thank you Olivier for your example patch. I was completely lost as I read Emmanuel’s description but after I saw the patch the system was quite obvious. Many thanks also to Emmanuel of course!
>
> One last question about the filepath issue:
>
> Is it correct that filepaths are only needed to organize the stuff while developing because when I finally build the application everything will end up in the program folder anyway?
>
>
—————————————————-

#137013

You must be logged in to reply to this topic.