Custom product installers and (PC) uninstallers

Author: Looniper

Tools Needed

  • WinRar or WinZip or any similar compression program
  • A text file editor

Introduction

Are you tired of having to apply updates, correct references, move folders about, and make customizations each time you install a product? Join the club.

The good news is, you don't have to keep doing things this way.

The following tutorial will give you the basics of creating installers and uninstallers(PC only) for your content.

Note Paths in this tutorial use the / due to constraints of the tutorial submission form. In all instances, it should be the reversed slash.

Step 1 - Original Installation

Since everything in our 'working folder' will be part of the installer created, it is inadvisable to use the actual Poser or DAZ Studio folders.

On the desktop, create a new folder. Name it whatever you like, but I like to use 'Construct'

Once this folder is created, run the original product installer and proceed until the screen titled “Choose destination location.”

At this point, press the 'Browse' button and navigate to the work folder on the desktop.

When the installation is complete, open the work folder to be certain the product was installed here, particularly if it is 4am and sleep is only a vague memory.

Step 2 - Making Changes

Now that we have our own little work-folder-world containing the product we wish to build an installer for, it is time to make changes.

This can be anything you would normally do after a product installs. Applying updates, correcting references, adding or deleting content or unneeded files, or even applying additional products.

For instance, to create an installer for Victoria 3 Base with the Head, Body and Male morph packs included is no more difficult than creating a separate installer for each. Although the resultant installer would be quite large.

For this tutorial, I am using the original DAZ Stephanie figure.

The figure files for her are found in Runtime/Libraries/character/DAZ People.

In this instance, I want to change the 'DAZ People' folder to simply 'People' saving the 'DAZ People' folder for the newer figures.

Also, in the Runtime/Geometries/DAZPeople folder, we find that there is not only the blStephanie.OBJ but an annoying little blStephanie.RSR as well.

Poser 4 will create this Geometry RSR file the first time Stephanie is loaded, so there is no need to have it eating up file space in our installer. Newer versions do not use these at all, so it really should be removed.

Just remember that Only the RSR files found in Geometries should be deleted. Those found in Libraries folders are used for those pretty little thumbnails you see when you browse figures, poses, etc.

Also be aware that moving any Geometry files or folders, texture images, or deltas will require you to edit each file that uses them.

Additionally, Upgrade versions and product updates often check for an existing product by looking in the default geometry folders of the older package. If it cannot find them there, it will not install. So changing Geometry folder or file names is not generally a good idea.

If you feel you must change these, at least keep a record some place safe of where they would have installed.

Step 3 - Making the Installer

Once all of the modifications are made, it is time to create the new installer.

What to select?

If you select a folder and attempt to compress it, some compression software (WinRar) will include that folder in the archive, while others (WinZip) will ignore it and add only its contents. We only want to archive the Runime, Templates, etc folders so..

If you are using WinRar, select the Contents of the work folder.

If you are using WinZip, select the work folder itself.

For any other compression software, make a test archive to see which method should be used.

With the correct item(s) selected, right and chose to create an archive.

For WinRar this is “Add to Archive.”

For WinZip this is “Add to Zip”

At this point it is time to decide if you want a Self Extracting archive (EXE) or a simple archive (.Zip, .Rar, .Arj, .Lha, etc)

The primary benefits of a self extracting archive are that you do not need to have the compression program installed to use it, and you can set a default location to install to.

The primary benefit of a simple archive is that in most cases, a virus is unable to infect it.

The settings for WinZip are as follows.

The settings for WinRar are as follows. (for a 'Simple' archive, uncheck the SFX box.)

Step 4 - Self Extractors

In order to create a self extractor with WinZip, make the Zip first, then right click it and chose to do so.

If you are using WinRar, simply check the 'SFX' box when creating the archive.

If you want to set the default installation location, which you probably do if you are making an executable installer, the following applies.

In WinRar, with the SFX box checked, use the 'Advanced' tab and press the SFX button. The box at the top is where you enter the default location to install to.

In WinZip, when you right click the Zip file and chose to create Self-Extractor, the box for this information is there already, simply fill it in.

The default installation location should be the folder that contains the 'Runtime' folder.

For example, Poser 4's default installation would be C:/Program Files/MetaCreations/Poser 4/

Viola! We now have an installer for our product that installs things Our Way!

Remember that you should always back up your original installers as well. This means twice(or more) the required archival medium, but it also means that no matter what you do to your custom installer, you have the original to fall back on.

Step 5 - Uninstaller Basics

Because this section utilizes downward DOS compatability (.BAT files), this section only applies to PC users. Mac users can still create similar uninstallers using scripts, but will need to educate themselves on the specifics of the scripting system used.

The first step in creating this uninstaller is to make a list.

In the work folder (which hopefully still contains the product) create a folder called 'Remove' right next to the Runtime folder.

Inside this, create a text file, preferably using the exact same name used for the installer.

In this text file, record the paths and file names the product contains.

Using Stephanie as an example with the modifications mentioned above, the list would look like this

Runtime/Geometries/DAZPeople/blStephanie.obj

Runtime/Libraries/character/People/Stephanie.CR2

Runtime/Libraries/character/People/Stephanie.rsr

Laetia at Renderosity has a free utility 'File List Maker' for content creators which, while not specifically designed for this, will help quite a bit in making this list.

At this point I should explain the DOS 'wildcards.'

Not Every file needs to be listed to be removed. Where files in the same folder have similar names, you can shortcut listing each of them individually using wildcards.

Examples:

blStephanie.obj means exactly what is entered, that exact file name.

b?Stephanie.obj means exactly what is entered, except that the ? can be Any character at all.

blSteph*OBJ means Any file with a name beginning 'blSteph' with the .OBJ extension.

blStephanie.* means Any file named 'blStephanie' with Any extension, or even no extension at all.

Attempting to delete *.* (which obviously means All Files) will cause DOS to stop and ask you for confirmation, but any other wildcards will be applied without consent, so be careful not to select too wide a range or you may end up deleting files from a separate product.

A good example of wildcard usage is this

Runtime/Geometries/DAZPeople/blStephanie.*

which indicates the blStephanie.OBJ and also the blStephanie.RSR that Poser will create the first time Stephanie is loaded.

Step 6 - Filling in the path

C:/Program Files/MetaCreations/Poser 4/Templates/MyV3_templateJPG is an exact file name.

We don't want to this so specific, because we don't know for certain this is where we will be installing in the future.

What we Do know, is how the installation will branch out from that destination, so we will use what is called Relative file location.

The key to this is 2 simple dots, '..' which mean to take 1 step back.

We know that the 'Remove' folder in which we are creating this BAT is sitting right next to the 'Runtime' folder, so to reach files or folders in that 'Runtime' folder, our BAT must look in ../Runtime/

So, to reference that OBJ (and potential RSR) file for Stephanie, the relative path from the uninstaller would be

”../Runtime/Geometries/DAZPeople/blStephanie.*”

Those quotes are important!

Remember that DOS does not normally allow spaces in a filename?

Well it Does allow a quoted filename, so we're cheating a bit.

Once relative pathing is applied, and we add those oh so important quotation marks, we end up with a list looking like this.

”../Runtime/Geometries/DAZPeople/blStephanie.*”

”../Runtime/Libraries/character/People/Stephanie.*”

(Notice the Stephanie.* in People? This removes both the CR2 and the RSR.)

Step 7 - Adding Commands

While the DOS command set for BAT file programming is extensive, only 2 are really important to us,

DEL which deletes the file named, and

RD which removes an empty folder.

The uninstaller first needs to delete files, so the list in our text file now becomes

DEL ”../Runtime/Geometries/DAZPeople/blStephanie.*”

DEL ”../Runtime/Libraries/character/People/Stephanie.*”

That removes the few files this product installs, but it is leaving 2 folders that may very well be empty now. 'DAZPeople' in Geometries, and 'People' in character. To do this we need to add 2 more lines to our text file

RD ”../Runtime/Geometries/DAZPeople”

RD ”../Runtime/Libraries/character/People”

Don't worry, if you use RD to remove a folder that has other products installed to it, the folder will not be effected. It only takes out Empty folders, so there is no harm done.

Step 8 - Closing it up

All that remains is to rename the uninstaller.txt to uninstaller.bat and it is good to go.

If you have already made the installer, and it works (test it!), you can test the uninstaller BAT file right here in the work folder without risking anything you have installed to Poser or DAZ Studio.

Be sure to test both the installer and the uninstaller before tucking them away on a CD!

You don't want to find out 6 months from now that the installer is missing an OBJ or the uninstaller is looking in the wrong folders.

Step 9 - Creative Additions

If you did not create the installer yet, or if you don't mind creating it again, you can easily include the Uninstaller (after testing) in the installer archive itself.

This way, the product will be installed along with the 'Remove' folder and the uninstaller BAT file to take the product back out.

But wait, there's more!

If you edit the uninstaller.bat file and add this at the End..

DEL “uninstaller.bat”

the uninstaller will even remove itself.

(Just be sure you archive it along with the rest of the product!)

Using these methods, you can easily create installers and uninstallers to add and remove products on a whim, rather than picking tediously through runtimes to find and remove specific elements, sometimes breaking other products in the process.

FINAL NOTE

Some products Share Files!

Sara's clothing packs are a prime example, several sharing the same reflection maps, each installing them if they are absent.

Uninstalling these with any product's uninstaller means they are gone for all of them until you install one of them again, so be careful what you remove.

Sometimes it is best to leave certain files out of the uninstaller just for this reason.

I hope you find this tutorial helpful,

-Looniper


 
© Copyright 2009 DAZ Productions, Inc.. All rights reserved I'm new to ArtZone.com   Support   Privacy Policy   General Rules   Terms