Forums > MaxMSP

get standalone name

Jan 13 2012 | 5:33 pm

hello maxers,

i am trying to detect the name of my standalone application on macox.
i only can get the path of the application and the main patcher name.

thanks in advance,

Jan 14 2012 | 1:27 pm

The thispatcher object can report the path of a patch. As soon as that patch becomes part of the application, this functionality ceases to work. If you were to make a sub patch however, that is hidden upon building the app, and stick it in manually after, it will be found and loaded as a patcher and hence reports it’s path. Since you know where in the folder structure of the built app it sits, you can work your way back to the folder that represents the app name. Does this make sense? Of course, since the abstraction is hidden when building, it can not have inlets or outlets.

-- Pasted Max Patch, click to expand. --

Jan 14 2012 | 5:40 pm

hello jvkr,

thank you very much for sharing this very creative trick !!!
i build a smal example, which also filters the application name from the path.

1) build an standalone application where the patcher: "pathreport" is NOT in the searchpath
2) copy the patcher "pathreport" inside the "" folder of your application package by hand
3) start your standalone application
4) press button getAppName

it is a pity, that we have to do this very handish workaround …
we have to do it after every standolone build, which can be stressy if we are in the final spurt of an project …


Jul 14 2016 | 4:05 am

Ugh :(
doesn t seem to work on Max 7 OSX 10.10.5 anymore…

I really would have loved this trick!

Any other workarounds (in Max 7) to get that damn appname on a mac?!


Jul 14 2016 | 6:10 am

Check messages to max.
Yoy can first ask if it is Max Patch or Standalone, if Max ask thispatcher to report path,
if it is a standalone then ask app to report the path

-- Pasted Max Patch, click to expand. --

Jul 14 2016 | 7:14 am

Ahh – yeah I see. It still only gives me the location of the .app but not the < >.
I need to provide a path to files inside the .app package, and the ususal way is to use sprintf, fill in the appname and the desired structure.
It proved really useful on windows not to have to keep track of the exact appname to access the files in the package structure.
It seems like the only way on mac is to "manually" fill in the appname, which is kind of cumbersome if you have several places throughout the patcher to keep track of…
I could probably include the filename in an abstraction so that I would have to update it only there, but then I run into problems with different versions and I still hoped there would be a way to extract the filename on mac somehow, so wouldn t have to worry about it at all.

Jul 16 2016 | 6:12 am

There is no way to get what You want just so simply.
There are some Java options, just I keep away from java, for many reasons.
If all You need is a path to some files in the .app, just make app folder a search path
in the standalone settings.
Then You can just use read xxx or open xxx file, without providing a full path.
Another thing is when complex folder/file hierarchy is needed.
I often need to do this kind of path stuff, and prefer to have Standalone App together with folders
containing whatever files are needed in the same folder.
This way You can get App path, add for example folder "Samples" using sprintf and fill a menu with all
sounds inside, or make it a search path using filepath object.
If You really want to stick with App Path/AppName/etc structure ( keep extra files inside Standalone )
just loadbang app name and send that to all sprintf objects that contain other Folders Names.
like sprintf symout %s (App Path reported)/%s (App Name received from loadbang)/Sounds
and you get something like :
"Mac-Hd:/My App Folder/"
Use bondo and tosymbol when collecting paths to sprintf objects

Jul 18 2016 | 2:54 am

Hmmm, adding a searchpath at the startup seems like something to look into.
It s been a while since I tinkered around with that, and it may need to prove to be consitent on Win / Mac but this could really reduce the trouble of keeping track of all those damn paths ;)
I don t know if writing to the files will be an issue without providing an exact path, but we ll see.
Thanks for all your Ideas! Very useful tips!

Jul 18 2016 | 4:48 am

Adding a search path at startup works ok, just it has to be done well before any read/write command
gets executed.
Storing search path in prefs is helpful for that ( settings in standalone object),
just I don’t know if that works correctly on all Mac/Win versions.

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

Forums > MaxMSP