How to find the setup location in an VBScript custom action for InstallShield? - vbscript

In an InstallShield project I have a VBScript custom action that conditionally needs to execute a certain file packaged with the install.
Normally I get the current directory of a vbs using code such as
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Which, if it returned the location of the Setup.exe that initiated the install, should work.
However when running the install, the current path (on XP) is C:\Windows\system32 instead of the location of the Setup.exe file I was expecting.
Assuming the output of my InstallShield build looks like the following
Disk1
->Setup.exe
->ISSetupPrerequisites
-->Req1
-->Req2
-->...
->OtherReqs
-->ConditionallyRunMe.exe
How could I run "\OtherReqs\ConditionallyRunMe.exe" from a VBScript custom action?
Thanks!!
(Note: I realize there are ways to conditionally run exe files from withing InstallShield, but in this case the requirements are not supported by InstallShield - unless there is a way to use a VBScript custom action return value as a condition to run another file?)

After a lot of messing around, I got it (actually found it in the InstallShield manual, and not Google, go figure :))!
This line of VBScript does the trick
disk1Path = Session.Property("SETUPEXEDIR")
The line above points to where ever the setup exe file was, so from there it's trivial to run any exe included with your install media.
Other useful ones I found, which I'll past here for reference are
'points to app data\downloaded install directory
MsgBox Session.Property("SourceDir")
'where the software wants to install to on the users system
MsgBox Session.Property("INSTALLDIR")
Not sure why it's so hard to find a good reference on MSI Standard properties (even just a list). The closest I found was this, but not all of them work (and not specifically for InstallShield at all). If anyone finds a good link with documentation about MIS Standard properties and their description please add a link here, so no one has to waste as much time on this as I did :).

Related

Looking for the simplest way to wrap a provided Setup.exe installer with a config.dat and a silent installation CLI execution

I am not familiar with Windows installer builder tools, other than having a conceptual understanding of them. I have a hopefully simple installer-file-wrapping-problem to solve where i would need some advice from people who know this field better than myself:
I have a vendor provided vanilla Setup.exe installer along with a custom config.dat file.
I can run the installer with "Setup.exe /S" which picks up the config.dat file in the same directory for a silent install just as I need it.
I now want to wrap both files into a single file self executable installer "CustomSetup.exe" that if launched with "Run as Administrator" silently unpacks the two files into the same directory, runs the silent install command line "Setup.exe /S" and deletes the previously unpacked files and directory afterwards. Effectively giving me a single-file one-click silent installer with custom settings from the vendor provided vanilla installer.
What is the simplest, most straight forward and elegant way of getting this done?
Most InstallShield/WIX/Windows Installer Tools tutorial- and documentation-pages i could find want to take me to an elaborate installer-project-building-academy first, something that is certainly useful for developers needing to learn how to build complex installer projects, but feels like overkill for just getting this seemingly simple thing done. Is there a lean way to do this? Many thanks in advance for your help.
For the record, I have found the answer to my own question.
Running the Windows on-board IExpress (as Administrator) easily produced exactly what I was after. Just type "Iexpress" into the command search box, run as Administraor and fidlle with it. Alternatively, this is someones Video explaining it https://www.youtube.com/watch?v=vXZyq0cMuKI

vsdraCOM causes the codebase path to point to build path

We have a couple of dlls we like to install using an msi.
In our test environment, we are using regasm -codebase to register the dlls.
As I understand from googling, this is accompliched in an msi project by setting the register property to vsdraCOM.
The problem is that when we run the installer and checks the registry, the codebase path is set to the path the file were in when building the msi.
I'm going to expand on Hans' answer and that link info, and it may be more than a comment can hold.
That reg file will contain the path to the file and the link article recommends using [TARGETDIR], which is basically wrong if the file is not being installed to the application folder. The path to your file should be written as [#file-key] in the reg file that you import. In a VS setup project the file-key will be (just an example) something like _B049230C37DE4B6787C578DCEE30252A. Open your MSI file with Orca, go to the File Table and use the file key in the File column that corresponds to your file name.
That comes from here:
http://msdn.microsoft.com/en-us/library/aa368609%28v=vs.85%29.aspx
the 7th bullet point. It resolves to the file path wherever it is installed to.
The other thing that can be done is to let Visual Studio do its incorrect thing, then go to the Registry table with Orca, find the path and put that [#file key] in it such as [#_B049230C37DE4B6787C578DCEE30252A] and people sometimes do those kinds of updates with a post build script to update the MSI.
None of these are great, but they should work and get you out of using the GAC. VS setup projects really should be using that [#file key] syntax, and it's just a silly bug I assume.
Speaking as someone who's made a full time living writing installs for 18 years, my first suggestion would be to switch to Windows Installer XML. If you insist on using .VDPROJ, I would suggest reading: Redemption of Visual Studio Deployment Projects.
The concept is you use Windows Installer XML to create a merge module and then consume that merge module with .VDPROJ. In Wix, you use Heat to harvest the DLL. It will extract the COM / Regasm metadata and author it as Registry table entries. This provides a nice clean encapsulation using authoring best practices and avoids the need to do any post build hacking of the built MSI database.

Installer for Executing Multiple Installs

I've been to stackoverflow.com many times, but this is my first time posting here. I'll try to be as specific and to the point.
I'm in the process of converting all my PC discs into digital .iso files and there's a few games I have that are multi-install discs.
Recently I've started using Inno Setup and so far I've had a lot of success consolidating multi-disc installs into a single program executable.
The one I'm currently focusing on is the Battlefield 1942 series. It requires initial installation, multiple expansion installs, plus a major patch, plus the installing of a mod that takes multiple steps.
My question to the community is how would I pack all of the above files into one executable and have them install everything in order? If it can be done through Inno, I'd like to try that. Or if you suggest another program I can always take time to try and learn it.
I've tried making a batch file for this a while ago but it ended up kind of clunky and I really didn't like the way it turned out.
Also, is there a way to insert check boxes into Inno to choose what executables run? (this part of the post isn't as important as the above request, just kind of a bonus if possible).
Really looking forward to the community's response on this!
One approach you can follow is to create a installer of installers, where you just pack the installers you have now and at installation time run each in the precise order you do now to get your fully installed and patched game.
That way, you don't have to learn each file/registry key or other settings each game have, and the risk of failure if you forget to include something vital to it.
What you have to do in order to do that properly, is to learn if the current installers accept it's own configuration from command line parameters or text files (many installers do it, for example the /silent or /verysilent command line parameters to run on the background). Once you do, use the [run] section of your script to launch each installer passing the parameters via command line or pre-made text files, or even you can create a text file or command line parameters on the fly using the [code] section with the built-in pascal script.
If your installers don't accept parameters, you can even reach your goal to keep all in one single exe file which you can run and then configure each individual installer as it launches.
Your question is overly broad to include here a working example, but you can find guidance by studying the scripts in the samples directory.
As for your final question
Also, is there a way to insert check boxes into Inno to choose what executables run?
You can use the [run] section to let the user select what to run at the end.
Or you can use the [tasks] section to create different sets of files/configurations.
A final word is to check the available flags for your install script entries, for example, deleteafterinstall to cleanup individual installer included among your [files] entries, or the [uninstallrun] section to give a unified uninstaller also.
In my opinion, if the final result should be fully patched version with mod installed, you should build new installer that will contain that fully patched game with mod.
You can do it easy way to find out what is changed/added by each patch, addon, MOD.
After installation of each thing (addon/mod/etc.) make a backup copy of the installation folder and check the registry entries.
Then just compare folders/directories and filter out specific files for each patch, addon, MOD.
At the end you will be able to add each addon and MOD as Components (files and registry entries) - that will create checkboxes in the Components Selection Wizard Page.
Easiest way:
For External Installers/3rd Party Apps at the end of installation more info to be found here: http://www.jrsoftware.org/ishelp/index.php?topic=runsection

Is it possible to detect if help file is contained in the setup file (msi or exe)?

I would like to know how can I detect if help file is contained in setup file for windows platform application (msi or exe). Is there any method to get this information without installing the software first ?
Of course setup file can be created by many setup makers like innosetup, installshield and so on. So I wonder if there is some universal method to solve this.
For an MSI based install it would be very easy. For example you can use the Microsoft.Deployment.WindowsInstaller interop via C# to open the MSI as an InstallPackageClass then access it's Files collection to see if it contains the file you care about.
For a Non-MSI based install, there is no universal way and in most cases, no way period. See, that's kind of the point of MSI: to have a standards based package rich in meta data to be able to see what it's doing. When you do some proprietary script driven installer you lose that openness.
If it's a MSI file, open it up using Orca, and you can view file names.
For both of them, you should be able to do an administrative install, which would extract the files, but not register anything. Depending on where the exe came from, doing an administrative install changes, since each vendor(installshield, innosetup, etc) has their own way to run an administrative install.
for a MSI it's simply
msiexec /a <msi_filename>
For an exe you'll have to look up how to pass the /a argument.

Freeware tool for creating a single file installer from an msi file + config file (thats easy enough for an End-User to use)

My installer requires there be two files in the same directory in order for it to install.
The installer (.msi file)
An organization specific config file that the installer copies. (This file is customized by the organization and then distributed to it's end users).
Since there are two files, the file has to be distributed as a zip file. Which presents the issue of if a user tries running the .msi without actually extracting the zip... only the msi file gets extracted. I am able to detect the issue in the install process and tell the user they need to unzip the file... but you know how noone actually reads error messages.
So, I'd like to make it more foolproof and so i was wondering if there was a simple tool that i could let my customers (ie the organization) be able to make modifications to the config file and when finished create a .exe file which when clicked would extract to a temp folder and then run the msi. I know there are solutions for this which require commercial software. I'm wondering if a simple freeware tool exists that can do this.
Edit: Accepted Solution Notes:
The one issue i ran into is the iexpress wasn't designed to be used for .msi files. As a result on the step that asks you for the Install Program. It's a combo box which if you had added a .exe file in the previous step could just select the .exe file from. Instead you have to manually type in
msiexec /i yourinstaller.msi
I was very pleased to find such a simple solution that's built in to windows. The only way this could be better is if it allowed for wildcards so that your iexpress project would be able to handle changes in the msi file's name which occur with each version. And defaulting the Install Program to the .msi file. These minor inconveniences are offset by the fact that end user wouldn't need to install any new software to create the package so I have stopped looking for other tools.
You could try using iexpress.
It enables you to package up a set of files which can be extracted, with the option of running an installation command automatically after extraction. It also has options to enable you to prompt users about things, show a EULA, restart the computer, etc..
I believe it comes as part of Windows (part of IE?) - try running iexpress.exe from the run dialog to get the UI.
The Wix project has a bootstrapper and packager for dealing with this kind of thing.
I've used wix a lot but haven't really looked at the bootstrapper/packager much - last time I had a quick look it wasn't really usable but that was a long time ago so it may be better now.
I'm guessing that the config file is something like a properties file, and that you want users to set the values of the properties "foo" and "bar". You don't need a separate tool to update the file.
I would do this:
Put one or more dialogs in the install that ask the user what the values of foo and bar should be, and set a couple public properties accordingly.
Write a custom action that writes the config file out to whatever location you want, including whatever values you want for foo and bar. This would be pretty easy in vbscript.
Put the custom action somewhere in the execute sequence (ideally as a deferred execution action, since you're making changes to the system).
Add an entry to the RemoveFile table, so the config file is removed on uninstall (assuming you don't want it to be left behind.)
Add an entry to the LaunchCondition table, to prevent users from doing a silent install. Or if you want silent install to be allowed, make the names of the public properties that hold the config data known, and make them part of the LaunchCondition. You would block "msiexec /i myapp.msi", but you could choose to allow "msiexec /i myapp.msi FOO=Something BAR=SomethingElse".

Resources