View Full Version : mzp.run: fileIn, run,drop folder/file.ms not working
11-03-2011, 08:36 PM
I have 2 mzp related problems:
1. I'm trying to make an mzp file which will always execute a maxscript file when it is unpacked. This should be regardless of whether it is through a drag&drop action, the main menu, or through maxscript. So I thought the fileIn function should do the trick. However, this does not seem to work.
2. If I try to use the run or drop command on a file that is not in the root folder, 3dsmax crashes upon dropping the mzp file into 3dsmax.
11-04-2011, 07:19 PM
Ok I found the solution to the second issue. It's a matter of supplying exactly the right format it seems:
run directory/file.ms --does not do anything
run "directory/file.ms" --crashes
run directory\file.ms --works
I haven't yet found a solution to the first issue though!
11-05-2011, 12:03 AM
Have you tried using execute instead of fileIn?
execute (openFile (getDir #scripts + "test.ms"))
I'm not entirely sure I understand point 1. Are you trying to run a script that you have just copied into a max directory from a mzp?
--Drag mzp into viewport
--Files are copied to 3ds max dir, (eg scripts)
--Files copied into 3ds max dir are then evaluated
Is that right?
11-05-2011, 12:50 AM
PJansen I also fought alot to find out how to do a correct MZP install... and I'm still missing somethings but here's what I'm using for iDevCam:
treeCopy "iDevCam" to "$scripts"
copy "Icons\\*.*" to "$ui\\Icons"
clear temp on MAX exit
clear temp on reset
messageBox "Thank you for buying iDevCam 1" title:"iDevCam"
I hope this helps! Cheers.
11-05-2011, 10:13 AM
What I want to in the mzp.run is always execute a ms file which contains an installer struct. I will then have a run and drop command that will start a UI if the mzp was dropped into max or run directly. This should start the installer UI.
However, I also want the installer struct to be loaded when using the msZip.unloadPackage command. This will ignore the run and drop commands in the mzp. I want to use that to be able to call the installer without creating the UI.
@TimHawker: using execute in the mzp.run does not work. It's not in the documentation either actually.
@Kameleon: I need to execute the file from the mzp.run, not from another maxscript file for the reason mentioned above.
11-08-2011, 12:05 AM
Thank you very much Kameleon!
I've been searching the whole night on a posting explaining how I might get that freaking mzp to work. The posting was super helpful.
11-08-2011, 12:16 AM
No problem, I've also spent hours trying to figure this out and could only gather bits of info from different places till I got it right... kind of, now I want to avoid having to copy it to a system folder because of permissions..... will try that later on :D
11-08-2011, 01:54 PM
I was just messing with this stuff yesterday. They explain it somewhat well in the MXS Help. Just took a little fiddling to get it right. Glad u got it sorted.
11-08-2011, 02:21 PM
Glad u got it sorted.Actually the first issue is not sorted out yet.
11-08-2011, 02:46 PM
In that case, this worked for me. It executed the .ms file on running the mzp.run
treeCopy turboTools to $scripts
11-08-2011, 02:51 PM
Sorry, that's not what I'm after. What I want is to execute a script in these three cases:
-The mzp is dropped into max (i.e. the drop command)
-The mzp is run through fileIn/run script (i.e. the run command)
-The mzp is unpacked using msZip.unloadPackage.
The last one is what I need a solution for. The maxscript documentation lists fileIn under the mzp documentation, but I found that this does not work at all in mzp.run.
The reason I want to do this is because I want to split the code for installing the tool and the installer dialog. The installer struct should always be loaded, the dialog only in the first two cases.
I can do this, but I don't really like it so much:
if msZip.unloadPackage mzp &extractDir &dropFile then
fileIn (extractDir + "/installer/installer.ms")
11-09-2011, 07:59 AM
Surely you want to use msZip.fileInPackage rather than msZip.unloadPackage.
In the documentation, it states that:
This method will unload the package while ignoring any drop or run commands and return the extract_dir and any primary drop file.
This method will unload and run a zip package
11-09-2011, 08:11 AM
Maybe my previous 'requirement' was not entirely complete. When I drop or manually run the mzp, in addition to the "install struct", I also want to run the "install UI" code. That's something I do not want when using msZip.unloadPackage.
11-09-2011, 08:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.