Forums > MaxMSP

A WORKAROUND: path to standalone from within standalone

November 3, 2010 | 5:29 am

Hey y’all,

After struggling with this for a while, I think I’ve found a workaround. Even better, it seems to work within (top-level) patches, and collectives.

I believe that (loadbang) -> (".") -> (absolutepath) returns the path to the directory in which the .mxf file that was opened lives.

This isn’t as useful as a working built-in function, or object, would be but might help others figure out "WHERE THE HECK THEY ARE" on the filesystem. :)

ST

ps. I run Max 5.1.4, on MacOS 10.6.4. Does anyone want to confirm or deny this on the other platforms?


November 3, 2010 | 8:02 am

It does work with Max4.6 under X.6.4 too.

p



Ch
November 3, 2010 | 9:28 am

Hi,

>> This isn’t as useful as a working built-in function

To get the "path to standalone from within the standalone", you can send the message "sendapppath" to max :

– Pasted Max Patch, click to expand. –

November 3, 2010 | 9:43 am

Zach Poff’s Multiscreener software, developed in MaxMSP, uses an elegant solution to find the path.
The patch first checks whether it is running in standard MaxMSP or whether it is in a standalone compiled app.
Depending on that outcome it then reports the path of the location of the patch-file or the path of the location of the standalone app.
Download it here (standalone and source patches):
http://www.zachpoff.com/software/multiscreener/
Then find the part in the source patches that does this. It’s isn’t that big of an app so pretty easy to find.

Thanks to Zach Poff!

edo.


November 3, 2010 | 9:45 am

I think the topic’s title doesn’t match the trick supertwang explains.

What he proposes returns the path to the patch location, or to the collective location. sendapppath will return the location of a standalone (and if used in a collective, of Max itself), which is not the same thing.

p


November 3, 2010 | 9:46 am

In the same struggle I had taken another approach. The ‘path’ message to [thispatcher] normally only works in a patch. But inside an abstraction (see below) that is hidden upon building the app, and later added manually, this functions well.

Your solution is simple and straightforward. However it relies on the fact that the search path is still pointing to the default location, a potentially unstable thing, maybe.

– Pasted Max Patch, click to expand. –

_
johan


November 3, 2010 | 9:54 am

hi,

if it can help, here is my method. I added a unix format of the path to use paths with some mxj objects.

it works well on windos/mac, in editable patch or standalone. but i think it could be a problem with mxf : the sendapppath message to max will return the path to Max5 application folder, and "path" to thispatcher will give "/".

here it is anyway :

– Pasted Max Patch, click to expand. –

November 3, 2010 | 4:26 pm

I found this solution through the forum. You need to use the patcher name.

– Pasted Max Patch, click to expand. –

April 15, 2011 | 10:55 am

Guillaume Evrard, you just found my solution, in the past like a return to the future concept or else :)
thanks a lot!


January 9, 2012 | 11:17 am

Minor modification to Guillaume Evrard’s solution.

With this little workaround, it now works in every case : Standalone, collective, patcher

– Pasted Max Patch, click to expand. –

June 5, 2012 | 7:42 pm

Minor problem with this last one is that it seems that it doesn’t tell me on which harddrive it is.
Since I have multiple harddrives in my MacPro it seems that jit.qt.record doesn’t know where to write to.


December 13, 2012 | 11:07 am

Hi,

I tried to use all of mentioned solutions. None of them was working on my Max 5.1 and Windows 7. Can someone confirm that at least one of them still works in this environment?


December 13, 2012 | 12:50 pm

what is your error?


December 13, 2012 | 3:37 pm

The path points to MAX installation folder like "C:Program Files…." instead of current application path.


February 12, 2013 | 10:44 am

The patch below is a combination of Guillaume Evrard and Michel’s solutions so that the absolute path SHOULD be discoverable in both .maxpat AND standalone formats.

When you use it as an object, give it an argument with the filename of which you are using the object in (if you intend to use it in both patcher and standalone).

Save the patch as, just say path.system.maxpat… you might call it like:
[path.system filename.maxpat]

Left outlet is the path, right outlet is the OS. Bang inlet to refresh.

Chris Vik.

– Pasted Max Patch, click to expand. –

April 17, 2014 | 10:54 pm

Does anyone have a solution for this with Mavericks and Standalones?

The above patcher from EthnoTekh Chris seems to work fine in a Mavericks patcher but not in a Standalone. Outputs seems to be /Applications/Max6.1/


April 17, 2014 | 11:20 pm

The only solution I have found so far with Mavericks is to put the YourStandalone folder with any external files like audio etc. in the Applications folder and just include an absolute path to it. Seems to work no matter where the mxf file is. Is there a better solution?


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