Write files to a specific folder

Thinksamuel's icon

I have a patch that needs to generate two files simultaneously. The two files are the same except that one is an uncompressed movie file, the other a compressed file. Until now, my files(I only experimented writing one at a time) end up in the same folder as where the patch is. How can I specify to which folder the files should go?

Hans Höglund's icon

I assume you pass the filename by a write message? Then you can use a sprintf object to prepend a path to your filename argument.

Preferably you should normalize your path with absolutepath or similiar.

Edit: typo

Lewis Keller's icon

With sprintf you can specify a path to write to like this:

Max Patch
Copy patch and select New From Clipboard in Max.

Thinksamuel's icon

Ok, now I have a problem. I already use sprintf for the name of my movie file. the name of the movie file is generated with ticks message, so I get something like "write 60543221.mov 30. h263 max"Now I need to add the searchpath. How do I do that?
I added the patch. Anyone can help me out?

Lewis Keller's icon

Sprintf provides an inlet for each % argument specified:

Max Patch
Copy patch and select New From Clipboard in Max.