get standalone name
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,
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 397.3ocuTEsaBBCE8Y3qno9JyPAc519GVxdYurXVpvcRMPKos5by3+9nW.EW bFbl3K2l64VN2y8zR256Qmq1.FJ4QxaDOus9ddHjCvqI2iVv2jjyM31nR3S0 7kzf5RVXiEgMjRtMypJf1RenjVi3avUlwFF1.KWUHj4fEYic.Tsx1h1t0JFS xDxEuqgDasFiFGUwDgM9d2xjXWLJbXHYVy2HRQ4TIw6F0UIRdApD5qfNkK4T Woc99tPv0M5Vbzu9wtEsFx9UITOyTj98S3IbE1C0tR3T2xny5Jw2HWQSVHJJ fK0ZBuLqoO1xzQXL5btRzs5tRlvfJEzW+Eln+zUB5myvhwkIm0ZXm0ZZpY3q aa9fmcs+nAkPexEF7hKBxzZDxrN9J1YZtP96WiPRb3Ga1F0JcRaKajIgsW+o fwJjbqPI6rmpWDHGlwLQZJH6doKUX3yyAb1CO4gdeUS7Qc5zpgcyTSTOTS7+ TM0Gb7xx0f1zPIJjp+GVpztz6CvTgrNEYjpg0h18G66Xam+OxxOgsA -----------end_max5_patcher-----------
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 "myApp.app/Contents/support" 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 …
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?!
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 739.3ocyWtrbZCCEFds4oviyVJit3qMq5ptqS551LcLXUPYLxLVBJsYx6dkN xlXHfwvfA1fPW7w+5SmKxuNvwabwZlzy8yt+v0w40ANNvPlAbp563MOc8j7T IrLu4LoLcJyancteWHThz4LXtuxDrUo0SIVNuXoJmofGDWMpcH0eWvruUOO2 maXKI+evDXzHT0vKRUSlwES+UIahx9PzfD8ztj.roASIPSzHzFawy.EUL9kO goMTDWTKHhYr2FLv7yvNt4Er+nsXs4Tr0fd7Jc+xSOok4raKU7i.NPHPiEQ3 jC.ERsflTjWTZM.PSznjH+PZf4eHDBm3OzLwFirEDQmAD2wCZCEkL0ske5sJ vOL0zPiZ0oBewbptKhnp26cKhB02QTpYbInRV4IyExA4xvyiMjPbC+hvv1hq R1KYpOpjoqpEyCeyHms1mtdOZ94gua9kIxri397ELF61mjpBl3fXHHqU+LRe 6lIY4tHW7ISD5gHx3TwTywVc6YQn3vQ5ruXLPH+Vc21eoM5krz150quwdLVd XSPQaEG9d8cQpG+YodctSYpxkBEeNqIex4B1jB83MSCcafVHjqB6aaPPsLxA nVPeUJaWpI0I0RWrvjDZ2aLcGgNJB0HCE1G+A1Md5odooFzNruSpkWjlYy+b onHXsy1ILJ.tNJos.2n8W17xAkLcldr9j4dAJUY2CZMcV7QcUfmBBd14i3fW rY7sQkrXY4j5cPUFS22e2YLohKRU7BQi0P2ZMy3YYLX55MYFWlNNmkc3bscU MlaUeT4fOldlyyVTvEpJjPPTS8ChMWHMLdSu2eQWtc.oq6.7UgnQcQN3SCn5 Oyzb+DjMwnktPu9fmcxi.c07PS15jqE4bcNd6h2VxUCNwcPMAWM0zEW+3qlZ ncPMjSLwVhs5g8SDHQHHPzzqGBDocvwO7LoosJl9lgqXkxJSBBQWZ+E68rBG Bc4BaWvhdkrU750GOvXs2F7eBwVvdC -----------end_max5_patcher-----------
Ahh – yeah I see. It still only gives me the location of the .app but not the <appname.app >.
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.
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/MyApp.app/Sounds"
Use bondo and tosymbol when collecting paths to sprintf objects
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!
Adding a search path at startup works ok, just it has to be done well before any read/write command
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.
Forums > MaxMSP