Articles

Advanced Max: Standalones, Part 3

Want to build a standalone Mac or Windows application? With Max, you can do just that and I will show you how. The result is an independent application anyone can run on their Mac or Windows machine with no Max installation required.

In the third installment in our series on creating standalone applications. I’ll spend 40 minutes guiding you through the process of creating your own file format, showing you how to make your app read and write documents, customizing menu bars, and even giving you the inside scoop on a secret object.

All the tutorials in this series: Part 1, Part 2, Part 3, Part 4, Part 5

by Timothy Place on February 14, 2018

Creative Commons License
JB Smith's icon

Hi Timothy
I've hit a wall with some standalone apps I've made available to music teachers to help students with sight reading. Is there any way to "sign" a Max standalone so users don't have to disable gatekeeper prefs to open it?
JB Smith

Timothy Place's icon

Hi JB! That topic will be addressed in a future video in this series!

MaMe's icon

Hi Timothy
The object Opened does not seem to work inside a standalone application.

Ernest's icon

HI timothy

The procedure for putting the path to the external file won't work after building a standalone. On Windows, the path to data includes the username, and other locations are write protected. On Macs it might work, but not if the user runs the app on the desktop, for example. So after distributing a standalone, the path will be wrong on other machines. In some cases it will present an open dialog to find the proper file, if for example using pattrstorage with savemode set to 3. But my general experience with Mac users is they write me to tell me it doesnt work, without any further specifics, the moment they see a file-open dialog. The reason is that the app has no way to know where to set the defualt path, so they have to navigate to it, and they don't expect that.

There's a number of solutions, and I look forward to hearing your preferred option.

Timothy Place's icon

@MaMe Thanks for that report! I just fixed the opened object problem and that will be in a forthcoming release.

@Ernest I need a little more background on what you are reporting as I could interpret that several different ways. A step-by-step sequence for me to reproduce would be most helpful. Thanks!

Ernest's icon

Oh, You build the app and open it. Then if the file isn't on the search paths set for Cycling74, it can't find the file and shows an open dialog, if it's a type of object that does (for others, like pattrstorage, it may only display an error in the console). But the path location of the open dialog is the path to the last file it opened, or defaults to C:\ root on Windows, which is what perplexes users.

it's a bit difficult to share as its 25~100 MB.

TConnors's icon

Great tutorials!

maybites's icon

cool thing this opened object! I was glad to learn that a solution for this problem is on the way. It also works when the file is dragged to the console.

I assume we can get rid of the opening of the text editor when we choose a different file type like:

max fileformat .sparck SPRK 0 "sparck file" file;

so max will not know what to do with it, but [opened] still passes on the info.

it seems to work, but maybe this has some repercussions I dont see, yet?

Timothy Place's icon

No repercussions, your observation is completely correct.

maybites's icon

thanks. so I will wait for the next release :-)

MaMe's icon

@Timothy Is there a way to get only the opened object before the next release ? and this tutorial doesn't appear is the list of tutorials in the Cycling74 website menu. Thanks

Timothy Place's icon

@MAME @MAYBITES The fix for the [opened] object is in Max 7.3.5 which we've just released! Enjoy!

lancehulme's icon

Hi Timothy,
I'm having to recompile all my application in Max7.3.5 and not enjoying it. I've run the gamut of possibilities trying to get an application to read midi files. No matter where and how I place it, I get the same error message: seq [filename].mid can't open. What am I doing wrong? Thanks!

Timothy Place's icon

@Lancehulme Do you have the same problem in Max? Or just in your app?

lancehulme's icon

No. Just in the apps (multiple). I've tried any number of different approaches to read files, none of which have worked. I've also created dummy apps to see if it was something in my patches or systematic to reading MIDI files in general and it's the latter. Any and all help is appreciated. Thanks! LH

MaMe's icon

@Timothy

The "opened" object now works in a standalone but can we use it without the text editor window opening automatically?

I have tried several things by changing the file type in the /init/max-fileformats. txt file but whatever the specified format type, opened indicates that it has opened a TEXT file and the text editor window loads the file automatically.

Is it possible to use "opened" inside a standalone in a discrete way?

lancehulme's icon

Hi Timothy,

Any progress w/ my standalone apps not reading .mid files?

Thanks! LH

Timothy Place's icon

Hi Lance,

I cannot reproduce the problem. I built a standalone out of the seq help patcher. When I click the "open" message and choose a .mid file it loads and plays. I wonder if there is something special about your app?

If you are able to share it, please send your app into support@cycling74.com and we'll take a look.

Cheers!

Cody's icon

Hi Tim!

First of all, great tutorials, I loved the FFT series and i'm gonna dive into packages after this one. Keep em coming, I can't get enough!

Quick question and I'm guessing the answer is yes, but I'm looking for some validation. I skipped Max6 so I'm trying to play catch up a bit here.

One could use the dict object (new to me from this video) to create multiple dictionaries for a polybuffer and pattrstorage and then combine them into a SUPER dictionary that is the combination of those "child" dictionaries to, therefore, save one .party file for the app instead of multiple .party files etc.

Am I on the right track?

Thanks in advance!

Timothy Place's icon

Hey Cody,

I'm not sure of the exact details of what you are trying to do. The pattrstorage object, for example, may want to directly control the reading and writing of it's files. So while I'm not entirely optimistic that this will work to combine things you can certainly try and see what works for you.

Cheers!

Cody's icon

Hey Tim,

Thanks for the reply! It's hard to remember exactly what I was thinking when I wrote the comment lol. But basically I was looking for a way for my patch to save ONE file instead of a .json file and a .txt file etc. Dictionaries seemed the best way to do that since I could nest dictionaries but it would mean translating everything out of pattrstorage and into the dictionaries syntax.

Thanks again!

Connor Pogue's icon

Is there a way to remove the default menu bar items such as: "show max console" , "about max" ,"midi setup", "overdrive" etc... ?

Source Audio's icon

yes, by editing maxinterface.json file.
here is one, with all that stuff removed:

maxinterface.json.zip
zip


but take care not to replace max one with it.
Everything is removed, but quit ...
any custom added menu items work as expected.

I use it in all standalones,
but good practice is to replace it only after verifying that no errors get displayed in console
on initial standalone run, and if all is ok, then replace it.
(because also call to open max console is removed)

Removing maxinterface.json file entirely from standalone would produce same effect,
if one needs no menus at all, but some gui elements then work a bit reduced, like umenu
ignores selection colors etc.

Connor Pogue's icon

Thank you!