How to modify the path opened with a read message from a patch

Aug 12, 2011 at 11:31am

How to modify the path opened with a read message from a patch

Hi anyone,

I am looking for a way to control the path that is opened when sending a read or write message to a coll object. The objective is to have a dedicated folder inside my main patch folder for storing presets, and that the read and write message directly lead to that folder. By default, it seems that this path is set to the one of the last patcher opened, and I did not find how to modify this.
Sending a read message along with a path name does not work.
I did not find any message to send neither to the coll object, nor to max to set a new path.
I am using max5.

Thanks in advance,

Aug 12, 2011 at 11:48am

I finally found a way.
As the path is set in function the last file stored or opened, I just send before a write message with the name and path of a file that is already inside the folder I want to set. You can also send a read message of an already existing file inside the folder that is in interest instead.
Then, as long as you do not change the path by the same way, it should be set to the folder you want.

Maybe this will help sb else,

Aug 12, 2011 at 4:18pm

I use Javascript like Patrick Delges said.

Save this as “js NameFile.js :
function name ()
outlet (0,;

And, there is my patch

– Pasted Max Patch, click to expand. –

This way, I know the path of the patch I open. All files like Coll, Pattrstorage etc… are saved in a subfolder named “Pref”.

It’s not very simple, but it works, even in Runtime (mxf file).


Aug 12, 2011 at 6:39pm

Thanks Michel,

But sorry, I have never used a patch in the way you left it in the post.
How do you open this with max5, please?

Aug 12, 2011 at 7:41pm
Aug 12, 2011 at 9:23pm

this has helped me to get the path, either in a maxpat or a standalone:

– Pasted Max Patch, click to expand. –
Jan 9, 2012 at 11:18am

Guillaume Evrard found an elegant solution a while ago in this thread :

I modified it a little and it now works in patcher, collective and standalone :

– Pasted Max Patch, click to expand. –

You must be logged in to reply to this topic.