[Closed] MZP installation package issues
I am trying to accomplish the following, fairly simple couple of steps that have to happen in order to install a script. I want to package the tool in a .mzp file so that it’s nice and tidy, and a successfull installation is guaranteed:
- Run a .ms script that does some housekeeping, removing any old versions of the script.
- treecopy the script source into the right place.
- Run another .ms script that shows a messagebox to the user telling notifying him of the successfull installation, and where to find the macroscript.
This sound very simple, yet it proved to be quite hard. After an absolutely titanic struggle that lasted for hours and hours, I have managed to get something working. I’m not entirely happy with the way it is constructed though, it feels hackish:
I now have one install.mzp which contains the script. In this file, run.mzp only copies the files to the correct location, but does nothing else.
Then I have the .mzp which I’ll distribute. This mzp contains the aforementioned install.mzp and the installation script. In this package, run.mzp first copies install.mzp to a temporary location, then starts the installation script (by using the run / drop command).
The installation script in turn does it’s housekeeping, then using msZip.unLoadPackage lets install.mzp do it’s work. If this was successfull, the temporary install.mzp is deleted, and the user is notified of the successfull installation.
Pfew. So much trouble for something so simple!
There must be a better way to do this. Any ideas?
Hi Pier,
you don’t need the double mzp file, you can run a .ms file from “mzp.run”. I can suggest to copy all the file in the default 3ds Max temporary directory, using the command treecopy from mzp.run, then run a regular .ms file, from mzp.run too, to manage the actual installation, that’s moving such files to their right location and perform other actions, like previous cleanup, display messages and run the script for the first time to make 3ds Max create the standard .mcr file.
It sounds a little messy, but please get a copy of IC.Shape, rename it as .zip and have a look at files:
- mzp.run
- IC_Shape_Installation.ms
I’m quite sure it will become all clear. Don’t hesitate to take the functions to handle files from IC_Shape_Installation.ms.
- Enrico
Thanks Enrico.
I guess that it would indeed be easier to just have the mzp.run handle “extracting” the data, and have the .ms script install it.
One question I have though: how do you get the system’s temp directory in the script? If I try GetDir #temp in max, it points to the max’s own temp directory…
Hi, I use the 3ds Max default temp directory and clean it up after the installation, is there a specific reason for you to want the system temp? Anyway you can get the Windows temp directory with: sysInfo.tempDir
- Enrico
Even if the Reference says $temp = System temp directory, the symbolic pathname $temp is exactly like (getDir #temp). You can keep the 3ds Max temp open and try performing IC.Shape installation, as soon as you drop the mzp on Max, you’ll see the files extracted there, when you finish or abort, they’re wiped away.
- Enrico