A WORKAROUND: path to standalone from within standalone

Nov 3, 2010 at 5:29am

A WORKAROUND: path to standalone from within standalone

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?

#53069
Nov 3, 2010 at 8:02am

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

p

#190852
Nov 3, 2010 at 9:28am

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. –
#190853
Nov 3, 2010 at 9:43am

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.

#190854
Nov 3, 2010 at 9:45am

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

#190855
Nov 3, 2010 at 9:46am

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

#190856
Nov 3, 2010 at 9:54am

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. –
#190857
Nov 3, 2010 at 4:26pm

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

– Pasted Max Patch, click to expand. –
#190858
Apr 15, 2011 at 10:55am

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

#190859
Jan 9, 2012 at 11:17am

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. –
#190860
Jun 5, 2012 at 7:42pm

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.

#190861
Dec 13, 2012 at 11:07am

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?

#190862
Dec 13, 2012 at 12:50pm

what is your error?

#190863
Dec 13, 2012 at 3:37pm

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

#190864
Feb 12, 2013 at 10:44am

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. –
#190865

You must be logged in to reply to this topic.