Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

InstallShield + System Variables?


Cartoonite
 Share

Recommended Posts

I've run into a bit of a snag in setting up my uA CD. One of my programs (a Winamp plugin of sorts called Hey, Mr. D.J.) installs from a setup.exe-based InstallShield installer. I am able to get it to install silently using the method outlined in the MSFN Unattended CD Guide (found here), but the install path saved in the setup.iss file that is created is absolute. If I attempt to replace the path with a variable one (C:\.... with %systemdrive%\...) the install fails. Does anyone know of a way to get around this?

Link to comment
Share on other sites


Thanks for the reply vcBlackBox. I had actually already considered doing something like this, but was unsure just how to go about setting it up. My script is actually a little bit different from his. I use a pair of type statements with an echo statement for the install directory line. For those that are interested, here is the code I used:

HeyDJ.cmd

cmdow @ /HID
FOR %%d IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%d:\WIN51 SET CDROM=%%d:
SET DIR=%CDROM%\Install\Apps\HeyDJ
set ISS=%systemdrive%\HeyDJ.iss
if exist %ISS% del %ISS%
type %DIR%\setup1.iss > %ISS%
echo szDir=%systemdrive%\Multimedia\Hey Mr DJ >> %ISS%
type %DIR%\setup2.iss >> %ISS%
Start /wait %DIR%\setup.exe /s /f1"%ISS%"
exit

This cmd file sits in the HeyDJ directory on my CD. Setup1 and Setup2.iss are the two portions of the iss file that are separated by the line that dictates installation path. Setup.exe is the original program installer. The extra variables are there just because I hate typing. :D

Link to comment
Share on other sites

Nice work Cartoon... been looking for something just like this.

Thanks durex, but I can't really take the credit. I just modified work done by edmoncu. Incidently, he, in turn, was modifying work done by someone else. Ah it is an interesting world we live in, eh? :D

Link to comment
Share on other sites

  • 4 weeks later...

Further testing on this has revealed that the order of the sections within the ISS file can safely be altered. Sections seem to be designated the same way that they are in WINNT.SIF, with [] bracketing the section header and everything in between the headers belonging to the header it follows.

Here is the original ISS file created by my record process for this app:

[InstallShield Silent]
Version=v6.00.000
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{476A9D78-2C04-40BE-A3B0-08591551D082}-DlgOrder]
Dlg0={476A9D78-2C04-40BE-A3B0-08591551D082}-SdWelcome-0
Count=4
Dlg1={476A9D78-2C04-40BE-A3B0-08591551D082}-SdLicense-0
Dlg2={476A9D78-2C04-40BE-A3B0-08591551D082}-SdAskDestPath-0
Dlg3={476A9D78-2C04-40BE-A3B0-08591551D082}-SdFinish-0
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdWelcome-0]
Result=1
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdLicense-0]
Result=1
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdAskDestPath-0]
szDir=C:\Multimedia\Hey Mr DJ
Result=1
[Application]
Name=Hey, Mr. D.J.
Version=2.1
Company=Ewal.Net
Lang=0009
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
[{B026AF1B-FA61-412B-A0BF-97FF84CB1842}-DlgOrder]
Count=0

As we can see, the destination path is right smack dab in the middle. This led to the script I posted previously, which would recreate this exact ISS file (with a different drive letter, where applicable). However, I have found that the order of the sections, and of the items within the sections seems to be irrelevant. This means that we can safely move the line that contains the system variable to the very bottom of the ISS file, like so:

[InstallShield Silent]
Version=v6.00.000
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{476A9D78-2C04-40BE-A3B0-08591551D082}-DlgOrder]
Dlg0={476A9D78-2C04-40BE-A3B0-08591551D082}-SdWelcome-0
Count=4
Dlg1={476A9D78-2C04-40BE-A3B0-08591551D082}-SdLicense-0
Dlg2={476A9D78-2C04-40BE-A3B0-08591551D082}-SdAskDestPath-0
Dlg3={476A9D78-2C04-40BE-A3B0-08591551D082}-SdFinish-0
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdWelcome-0]
Result=1
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdLicense-0]
Result=1
[Application]
Name=Hey, Mr. D.J.
Version=2.1
Company=Ewal.Net
Lang=0009
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
[{B026AF1B-FA61-412B-A0BF-97FF84CB1842}-DlgOrder]
Count=0
[{476A9D78-2C04-40BE-A3B0-08591551D082}-SdAskDestPath-0]
Result=1
szDir=C:\Multimedia\Hey Mr DJ

Now we can remove the destination path line from this file and save it onto the source CD. Finally, we copy this file to the systemdrive during our install process, and then echo the destination path line as before. My new script to install this app looks like this:

cmdow @ /HID

::Set variables
FOR %%d IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%d:\WIN51 SET CDROM=%%d:
SET DIR=%CDROM%\Install\Apps\HeyDJ
set ISS=%systemdrive%\HeyDJ.iss

::Create ISS file
copy /y %DIR%\HeyDJ.iss %ISS%
echo szDir=%systemdrive%\Multimedia\Hey Mr DJ >> %ISS%

::Install program
Start /wait %DIR%\setup.exe /s /f1"%ISS%"

::Clean up and exit
del /f %ISS%
exit

I know I'm not the only one who has had trouble getting Installshield installers to properly install silently. Hopefully this will help other people who are experiencing the same trouble.

Edit: Replaced CODE tags with CODEBOX.

Edited by Cartoonite
Link to comment
Share on other sites

  • 6 months later...

Hello.

I am very insterested in this topic, but but limited knowledge doesn't allow me to fully understand it.

I am installing PowerDVD 6 using Astalavista method, so I have a sfx rar file, which will extract all the files to a temp dir and execute setup.exe -s.

setup.iss is inside the rar file along with all the others.

How can I use Cartoonite's method?

Also, do I move the destination path line to the end of setup.iss or do I remove it?

Thank you,

Link to comment
Share on other sites

Sorry if some of my explanation wasn't quite clear, John. I will try another way of explaning. Hopefully it will be easier for the less experienced to understand.

I didn't read the whole thread that you linked to, but I think I get the general idea. Having your Setup.iss file inside a rar archive will make the process a little more complicated, but nothing too difficult.

As I mentioned before, the problem with unattended InstallShield setups is that InstallShield doesn't recognize system variables. This means that the destination directory is absolute. If you want to install Power DVD in C:\Power DVD\, for example, it will always be installed on the C: drive. Even if you were to install Windows itself onto D: or E: or whatever, Power DVD, and any other InstallShield applications, would be installed onto C: drive.

The solution that I've developed (again, a modified version of a solution created by others) gets around this limitation by creating the ISS file after Windows has been installed.

To use my solution in combination with the one you linked to, you will need to make some small changes. First, you will need to write a batch file that will be in archive. For simplicity's sake, I will call it PwrDVD.cmd. You will then need to modify your archive so that, instead of executing setup.exe -s, it will execute the batch file. You can do that by replacing

Setup=setup.exe -s

in your SFX comment with this

Setup=PwrDVD.cmd

The rest of the comment should remain unchanged.

The batch file itself is fairly straight-forward. A small modification to the one I used should work just fine for you. In case you are unfamiliar with batch scripting, or command files, if you prefer, the lines beginning with :: are there for human reference only. The PC ignores these lines when processing the script. The rest of the lines are basic command line commands that will be processed in order.

cmdow @ /HID

::Set variables

set ISS=.\Setup.iss

::Create ISS file

copy /y .\PwrDVD.iss %ISS%

echo szDir=%systemdrive%\Power DVD >> %ISS%

::Install program

Start /wait .\setup.exe -s

::Clean up and exit

del /f %ISS%

exit

The part in green is the important bit. This is the path where you want your application installed. The example above will install Power DVD in a folder called "Power DVD" on the drive where Windows is installed. (most commonly C:\Power DVD). Edit that line so that it reflects the installation path you want. To use the default installation path as another example, you would replace the green code with %systemdrive%\Program Files\Cyberlink\PowerDVD.

The last, and probably most complicated part, is creating your new Setup.iss file. For my example, I will use the one from the thread you linked to, since I don't use Power DVD myself. Open your ISS file and find the line that specifies the installation path. I will use green again to highlight it here:

[installShield Silent]

Version=v6.00.000

File=Response File

[File Transfer]

OverwrittenReadOnly=NoToAll

[Application]

Name=PowerDVD

Version=6.0

Company=CyberLink

Lang=0009

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-DlgOrder]

Dlg0={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdWelcome-0

Count=8

Dlg1={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdLicense-0

Dlg2={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdDisplayTopics-0

Dlg3={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdRegisterUser-0

Dlg4={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdAskDestPath-0

Dlg5={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdSelectFolder-0

Dlg6={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SELECTSKINDIALOG-0

Dlg7={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdFinish-0

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdWelcome-0]

Result=1

[{6811CAA0-$$$-11D4-$$$$-0050BAE317E1}-SdLicense-0]

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdDisplayTopics-0]

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdRegisterUser-0]

szName=XXXXXXXX

szCompany=XXXXXXXX

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdAskDestPath-0]

szDir=C:\Program Files\CyberLink\PowerDVD

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdSelectFolder-0]

szFolder=CyberLink PowerDVD

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SELECTSKINDIALOG-0]

DefaultSkin=Glamor

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdFinish-0]

Result=1

bOpt1=0

bOpt2=0

You will notice the 2 blue lines, in addition to the green one. These are the other important lines. You want to move these 3 lines to the end of the file, then delete the destination directory line. Save the result as PwrDVD.iss. You should end up with something that looks like this:

[installShield Silent]

Version=v6.00.000

File=Response File

[File Transfer]

OverwrittenReadOnly=NoToAll

[Application]

Name=PowerDVD

Version=6.0

Company=CyberLink

Lang=0009

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-DlgOrder]

Dlg0={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdWelcome-0

Count=8

Dlg1={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdLicense-0

Dlg2={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdDisplayTopics-0

Dlg3={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdRegisterUser-0

Dlg4={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdAskDestPath-0

Dlg5={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdSelectFolder-0

Dlg6={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SELECTSKINDIALOG-0

Dlg7={6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdFinish-0

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdWelcome-0]

Result=1

[{6811CAA0-$$$-11D4-$$$$-0050BAE317E1}-SdLicense-0]

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdDisplayTopics-0]

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdRegisterUser-0]

szName=XXXXXXXX

szCompany=XXXXXXXX

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdSelectFolder-0]

szFolder=CyberLink PowerDVD

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SELECTSKINDIALOG-0]

DefaultSkin=Glamor

Result=1

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdFinish-0]

Result=1

bOpt1=0

bOpt2=0

[{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}-SdAskDestPath-0]

Result=1

There are really only 2 differences between this file and the previous one. The 2 blue lines have been moved to the bottom, and the green line has been removed. Call this new file PwrDVD.iss and save it in the same folder where you currently have Setup.iss. You can now delete Setup.iss if you want to save a few bytes on your CD/DVD. The way the script is written, you can leave the file if you want to. It shouldn't make a difference.

When the archive is extracted during your unattended installation and the batch script is run, the first thing it will do is copy the second file to Setup.iss. The echo command then adds the customized installation path to the end of that file. The script then runs Setup.exe -s. Once the installation is done, it deletes the newly created Setup.iss file and then exits.

I hope this helps. Please keep in mind that this is untested, so be sure to test it before you permanently delete any known working installations you have. Post back with any results, comments or questions.

Appologies to all for the length of the post. Unfortunately CODE and CODEBOX tags don't allow any way to emphasize the code within them, so I had to use QUOTE tags instead.

Edit: Spelling and grammar corrections.

Edit2: Changed PwrDVD.iss as per comment by JohnS below.

Edited by Cartoonite
Link to comment
Share on other sites

Success! :thumbup:thumbup

Your tutorial is great in its simplicity.

There is only one thing to do for it to work:

- The PwrDVD.iss has to have a blank line at the end. So, after Result=1 just hit ENTER.

It was not working at first, but then I opened the setup.iss that PwrDVD.cmd was creating and it showed like this:

Result=1szDir=E:\Program Files\Cyberlink\PowerDVD

So, if there is a blank line at the bottom it will be created like this

Result=1
szDir=E:\Program Files\Cyberlink\PowerDVD

and it will work.

Thank you very much :thumbup

Edited by JohnS
Link to comment
Share on other sites

Success! :thumbup  :thumbup

Your tutorial is great in its simplicity.

There is only one thing to do for it to work:

- The PwrDVD.iss has to have a blank line at the end.

Great. Glad to hear it is working for you. I will make that change in the above post right now. Thanks for your feedback.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...