fn delDir DirPath = (
if doesFileExist dirPath do (
command = "RD /S /Q \""+dirPath+"\""
HiddenDOSCommand command startpath:".\\"
)
)
fn delFile filePath = (
if doesFileExist filePath do (
deleteFile filePath
)
)
fn copyDir sourceDir destDir = (
command = "XCOPY \""+sourceDir+"*\" \""+destDir+"\" /Q /I /S /Y"
HiddenDOSCommand command startpath:".\\"
)
fn uninst = (
if ::OpenAdvancedUVNormalizer !=undefined do (
d=windows.getChildHWND 0 (title1+" v2.4.7")
if d !=undefined do windows.sendMessage d[1] 274 61536 0
)
::OpenAdvancedUVNormalizer=undefined
gc()
sleep 1
delDir (userscripts+title1)
delFile (userstartupscripts+"auvn_autoload.mse")
for i in (getFiles (usermacros+"AUVN*")) do delFile i
)
fn checkuninst = (
if doesFileExist(userscripts+title1) or doesFileExist(userstartupscripts+"auvn_autoload.mse") then (
if qb = queryBox ("You have the "+title1+" installed. Do you want to uninstall it first?") title: "Warning" do uninst()
qb
) else true
)
on auvn_installer open do (
if oldmax do (
lbl1.text="Only 3dsmax 2010+ is supported!"
install1.enabled = false
uninstall.enabled = false
)
)
on install1 pressed do (
if checkuninst() do (
setWaitCursor()
copyDir (tempdir+"scripts\\") userscripts
sleep 1
lbl1.text="Installed successfully."
try filein (userscripts+title1+"\\auvn.mse") Catch(Messagebox "There was an error installing Adv. UV Normalizer" title:"Error")
if queryBox "Installation complete!\n\nGo to Customize -> Customize User Interface, choose \"AUVN\" in the Category list and assign the script wherever you want.\n\nOpen the Customize User Interface dialog now?" title: title1 do actionMan.executeAction 0 "59226"
)
)
on uninstall pressed do (
if queryBox "Are you sure?" title: "Uninstall!" do (
lbl1.text="Started..."
setWaitCursor()
uninst()
lbl1.text="Uninstalled successfully."
)
)
on auvn_installer close do (
if tempdir == symbolicPaths.getPathValue "$temp"+"\\auvn2\\" do delDir tempdir
auvn_installer = undefined
gc()
)
I too have instal.ms file in my ALL3DVRaySceneValidator category:"ALL3D" buttonText:"ALL3D Scene Validator v0.6" toolTip:"V-Ray Scene Validation Tool v0.6 for ALL3D" icon:#("ALL3DVRaySceneValidator", 1) mzp file:
(
filein "$usermacros\ALL3DVRaySceneValidator.mcr"
colorMan.reinitIcons()
messagebox("Install notes:\n\n1. Go to Customize > Customize User Interface and select "Toolbars" Tab.\n\n2. Select "ALL3D" Category.\n\n3. Drag the "ALL3DVRaySceneValidator" to where you want it on toolbar.") title:"ALL3D V-Ray Scene Validator v0.6" icon:#information
)
I want you to create my install.ms file like AUVN_247's installer.ms.
Also, I want it to open Customize User Interface's Toolbar tab, after successful installation of the script.
Here is an install.ms script tailored for your ALL3D V-Ray Scene Validator v0.6 script, modeled after the AUVN_247 installer. This script will create a dialog with Install and Uninstall options and will open the Customize User Interface dialog to help you assign the script after installation.
maxscript
try destroyDialog validator_installer catch()
rollout validator_installer "ALL3D V-Ray Scene Validator v0.6 Setup" width:210 height:60
(
local usermacros = (symbolicPaths.getPathValue "$usermacros") + "\\"
local tempdir = getFilenamePath (getSourceFileName())
local title1 = "ALL3D V-Ray Scene Validator v0.6"
label lbl1 "Select an option:" pos:[5,5] width:200 height:13
button install1 "Install" pos:[5,25] width:120 height:30 toolTip:("Install to \""+usermacros+"\"") across:2
button uninstall "Uninstall" pos:[130,25] width:75 height:30
fn delFile filePath = (
if doesFileExist filePath do (
deleteFile filePath
)
)
fn copyFile sourceFile destFile = (
copyFile sourceFile destFile
)
fn uninst = (
-- Uninstall steps
delFile (usermacros + "ALL3DVRaySceneValidator.mcr")
-- Remove any additional files or icons if necessary
)
fn checkuninst = (
if doesFileExist (usermacros + "ALL3DVRaySceneValidator.mcr") then (
if qb = queryBox ("You have "+title1+" installed. Do you want to uninstall it first?") title: "Warning" do uninst()
qb
) else true
)
on install1 pressed do (
if checkuninst() do (
setWaitCursor()
-- Copy the .mcr file to usermacros
copyFile (tempdir + "ALL3DVRaySceneValidator.mcr") (usermacros + "ALL3DVRaySceneValidator.mcr")
-- Re-evaluate the newly copied .mcr file
fileIn (usermacros + "ALL3DVRaySceneValidator.mcr")
colorMan.reinitIcons()
sleep 1
lbl1.text="Installed successfully."
if queryBox "Installation complete!\n\nGo to Customize -> Customize User Interface, choose \"ALL3D\" in the Category list, and assign the script wherever you want.\n\nOpen the Customize User Interface dialog now?" title: title1 do (
actionMan.executeAction 0 "59226"
-- Note: This opens the Customize User Interface dialog; selecting the 'Toolbars' tab must be done manually by the user
)
)
)
on uninstall pressed do (
if queryBox "Are you sure?" title: "Uninstall!" do (
lbl1.text="Started..."
setWaitCursor()
uninst()
lbl1.text="Uninstalled successfully."
)
)
on validator_installer close do (
validator_installer = undefined
gc()
)
)
createDialog validator_installer style:#(#style_toolwindow, #style_border, #style_sysmenu)
Instructions:
Preparation:
Place your ALL3DVRaySceneValidator.mcr file in the same directory as this install.ms script.
Packaging:
If you're creating a .mzp package, include this install.ms script and your .mcr file in the package.
Set up the .mzp file to execute install.ms upon running the package.
Installation Process:
When you run the install.ms script, a dialog will appear with "Install" and "Uninstall" options.
Click "Install" to copy ALL3DVRaySceneValidator.mcr to your $usermacros directory.
The script will then offer to open the Customize User Interface dialog for you to assign your script.
Assigning the Script:
In the Customize User Interface dialog, go to the "Toolbars" tab manually.
Select the "ALL3D" category.
Drag the "ALL3DVRaySceneValidator" action to a toolbar or assign it to a menu or keyboard shortcut as desired.
Note:
The script checks if the .mcr file already exists and prompts you to uninstall the previous version before installing a new one.
The actionMan.executeAction 0 "59226" command opens the Customize User Interface dialog but does not select the "Toolbars" tab. You will need to navigate to it manually.
Uninstallation:
To uninstall the script, run install.ms again and click "Uninstall".
This installer script provides a user-friendly way to install and uninstall your ALL3D V-Ray Scene Validator v0.6 script, similar to the AUVN_247 installer.