Open a New Patcher From a Standalone

madbutter's icon

I want to programmatically open a new patcher or collective from a standalone app. The idea is that I have a base standalone that users will download and that new "utility" patchers can be downloaded in the future and also run from the same standalone. The standalone app is installed with an installer and I will also use an installer to download the new patchers, so it will put them in a certain known directory next to the standalone. I can scan this directory's contents for .maxpats and add them to a umenu to let the user pick one and open a patcher in a new window.

Part of the idea is to save download time by not making these utilities into their own standalone apps, by using the same runtime for everything.

I see that I can open a .maxpat file or a collective using the Open command in the standalone File menu. But I don't want to try to instruct the user on how to find and open these patchers that way. I can imagine opening a new embedded patcher window pre-built in the original standalone that in turn has an embedded bpatcher and changing the source file of that bpatcher dynamically. Or I see that using ";max openfile xxx somepatcher.maxpat" also opens a patcher (but not a collective like the Open command will) but the documentations says that this is for building collectives.

Is there a tried-and-true way of doing this? Or a best practice? Or a caveat to doing it one way or another. I've been playing around and none of these solutions seem elegant. ;)

Thanks for any advice, help.
bob

Arvid Tomayko's icon

I've not tried this with standalones yet, but sending the "loadunique filename.maxpat" message to pcontrol is I think how I handle this sort of thing in my patches. Works in runtime.

Also, if this works, it might be easier to install the "utility patchers" with main patcher because, especially when compressed, max patches are pretty small.

madbutter's icon

Hi Arvid,
Yes, thanks. I thought pcontrol was only for embedded patchers but I see that load or loadunique messages do what I need them to do.
The idea with the "utilities" is that they will be added incrementally as needed in the future, so I just needed a way to open them from within my standalone. And there it was all along ;)