|Note regarding InstallScript versions: The samples on this page have been developed with various versions of InstallShield. Some of them require a minimum InstallShield version or may only work in the one version they have been created for. Often it will be possible to make them compatible with other InstallShield versions.|
Sometimes you need to run an external setup as sub install that doesn't have a silent mode. AutoIt is a freeware tool that can "click" buttons, select checkboxes and the like. His is a InstallScript sample that uses AutoIt's COM interface to control an external setup. (The sample was taken from a project and requires modification to be used in your project).
AutoItSample.zip Written by
File size: 1.537 bytes Last update: 2005-11-18
AutoIt Web site
Sometimes your setup program may lose focus, e.g. because it is launching another program. To regain focus you can call the SetForegroundWindow function in the Windows API. However on Windows 98/Me and Windows 2000 or later the system restricts which processes can set the foreground window, and typically your setup program won't meet the criteria.
Here are two solutions to this problem:
Other processes than the current forground process are prevented from using SetForegroundWindow for a certain amount of time after the last user input. You can set this timeout to 0 to allow any process to put itself at the top of the Z order at any time. Note that this is a global setting, so other processes can grab the foreground window, too. Also you should restore the previous timeout value after your setup has finished.
To use this method in InstallScript, add these defines to the top of your setup.rul:
#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 #define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 #define SPIF_UPDATEINIFILE 0x0001 #define SPIF_SENDWININICHANGE 0x0002
Then, at the beginning of the setup.rul add this:
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &lockTime, 0); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
Then, at the very end of the setup.rul add this:
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, lockTime, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
You should also add this last statement at any location that would terminate your setup.
Written by David Boyd
Last update: 2001-08-16
A process can set the foreground window if it currently is the foreground process or if it was started by the foreground process. Here is a program that will launch your setup and grant the launched program the right to set the foreground window to put itself at the top of the Z order. This right is granted only to your setup program, not to other processes.
by Joe Nathanson
File size: 14.044 bytes Last update: 2001-06-27
This sample installation program can call a child setup, packaged as self-extracting executable, in silent mode. In this sample, the Acrobat Reader 4 installer is used as child setup.
Features of this sample:
Comments on the installation procedure:
Note: To reduce the download size the Acrobat Reader 4 self-extracting executables have been removed from the "AR4Installer\Setup Files\Uncompressed Files\Disk1" folder. Before building the setup, please place the ar405eng.exe, ar405deu.exe, and ar405jpn.exe (available at http://www.adobe.com/products/acrobat/alternate.html) in this folder, because otherwise the installation will fail.
AR4installer.zip Written by Valery Atlas
File size: 1.220.843 bytes Last update: 2000-08-17
The standard way to have a DOS window close after a batch file or DOS program has finished would be to set the "Close on Exit" flag in the shortcut properties (i.e. PIF file). But what if you don't want to use a PIF, or you have no way to the set flag programmatically? Here is an alternative:
I found in the Microsoft Knowledge base a small message at the end of a related article that getting a window to close on exit could be caused within a batch file by adding
echo off cls
to the end of the batch file. It seems that as long as there is no output left on the screen, Windows 95/98 closes the DOS window automatically. I have tried this as well as clearing the screen at the very end of my DOS application, and it works fine there as well. Obviously all that is truely needed in a batch file is:
And wrapping a batch file around a program you don't have full source control over like
@echo off <yourprog> @cls
would also cause the window to close.
Written by Terry Bailey
With this function you can specify whether the launched program should run in a normal window or invisible, which is useful for running DOS commands or batch files without flashing up a DOS box. It also waits for programs that don't create a window. You can specify a time-out for the launched process to finish. Also the _LaunchAppEx function returns the result code of the launched program.
This script is based on and replaces the functions HideAppAndWait by Elihu Rozen and LaunchAppGetExitCode by Ed Smiley. It combines their functionality, and was modified to consume less processor time while waiting for the launched process.
Note: Reportedly the _LaunchAppEx function fails on Windows Server 2003 SP2 (but works on SP1 and R2). Commenting out the following lines seems to fix the problem:
LaunchAppEx.zip Written by Stefan Krueger
File size: 5.465 bytes Last update: 2002-12-05
hideappandwait.zip Written by Elihu Rozen
File size: 1.262 bytes Last update: 2000-04-06
by Ed Smiley
File size: 2.566 bytes Last update: 1998-06-15
This script is a wrapper for the PerlEz.dll from ActiveState. It enables you to embed or execute external Perl scripts from InstallShield. A readme and example project is included in the script file.
PerlEz.zip Written by
File size: 985.451 bytes Last update: 2003-08-20
_IsPresentAcrobat tells you whether Acrobat is installed, and AcrobatGetOpenCmd returns the string you need to use to run Acrobat - you pass this string to LaunchApp. These functions are intended for Acrobat 3.0 and 4.0.
Launching the Acrobat installer from your script is a bit tricky. InstallShield knowledge base article Q101633 gives helpful information.
prototype _AcrobatGetOpenCmd ( BYREF STRING ); prototype _IsPresentAcrobat ();
See also: Information about installing Acrobat Reader can be found on the Redistributable Packages page
Updated to support Acrobat Reader 4.0 (the previous version did only detect 3.0)
findacrobat.zip Written by James Frater and Jonathan Jarvis
File size: 927 bytes Last update: 04/12/1999
Many tools use INF files for installation. This mechanism was introduced with Windows
95 and NT 4.0 and is also used in newer Windows versions. Here is a function to start such
INF files from script.
Note: This function is not intended for device driver INF files (see below for driver driver installation).
prototype InstallInfFile(STRING, STRING);
See also: Create INF File for Software Distribution
installinffile.zip Written by Stefan Krueger and Brian Howson
File size: 1.708 bytes Last update: 2001-04-05
Microsoft has released a toolkit, but it only works for drivers that are digitally signed.
To ensure the best possible user experience, installation of both hardware
device and software driver should run as seamlessly as possible, with a minimum
of user intervention. Microsoft provides tools and guidelines to help you create
installation packages that meet this goal.
This toolkit requires that your drivers are digitally signed, even if you set the 'silently accept unsigned' policy.
This sample script and exe file can be used to register Plug&Play device drivers. It does not make use of Microsoft's Device and Driver Installation Toolkit.
DrvInstall.zip Written by
File size: 19.927 bytes Last update: 2004-02-03
This script calls functions in psapi.dll to retrieve running applications and to shut down specific programs. It requires Windows NT 4.0 or later - Windows 95 and 98 are not supported.
InstallShield 5 version:
prototype ShutDownApp(); prototype GetRunningApp( BYREF STRING );
by William F. Snodgrass
File size: 2.667 bytes Last update: 11/03/1999
InstallShield 6 version:
prototype NUMBER ProcessEnd(STRING); prototype BOOL ProcessRunning(STRING);
ProcessControl.zip Written by Richard Iwasa
File size: 4.813 bytes Last update: 2000-05-02
This code fragment loads an HTML file into the default browser. It can also be used to open any other file type with the associated application. In contrast to other scripts for the same purpose, it doesn't try to read and parse registry entries, but calls the FindExecutable and ShellExecute WinAPIs.
ShellOpen.zip Written by David Boyd
File size: 500 bytes Last update: 2000-08-03
This function uses the application that is registered for the file type to print the file.
printfile.zip (638 Bytes) Provided by Stefan Krueger
Earlier releases of InstallShield 5 had a problem with self-registering EXE programs in batch mode. This function registers such EXEs without batch mode and logs them for uninstall.
prototype ManualRegister( STRING, STRING )
manualregister.zip (698 Bytes) Provided by Mark Kendzior
Sometimes an API call requires or returns a pointer to a string. In IS5/6 indirection is only possible for number variables. The PointerToStr function serves as indirection for strings, so you can obtain the string value stored at the memoty location referenced by a pointer variable. Example:
STRING svText ; POINTER psvText ; psvText = &svText; PointerToStr(svText,psvText);
prototype PointerToStr(BYREF STRING, POINTER)
PointerToStr.zip Written by Ide Nentjes
File size: 768 bytes Last update: 2001-08-04
Many people are confused with the concept of dll. VC++ dlls are a completely different animal than VB dlls and as such are used completely differently. VB dlls are COM objects that do not contain the header info and entry points that VC++ dlls do. Therefore, VB dlls must be registered with regsvr32.exe before being used.
Remember that the appropriate VB version of the VB runtime files must to be installed before you can use your VB DLL.
Download and add this code to your onBegin and onEnd functions and you'll be able to use your VB DLL in IS6. This code will not work in IS5 because it doesn't have COM support.
VBdll.zip Written by Justin Ball
File size: 1.513 bytes Last update: 11/23/1999
|News||Discussions||Windows Installer||Virtualization||Related Tools||More Help||InstallScript||About InstallSite||Shop||Site Search|
|Neuigkeiten||Diskussionsgruppen||Windows Installer||MSI FAQ||Artikel||Shop||Suche|
Copyright © 1997-2013 by InstallSite Stefan
Krueger. All rights reserved. Legal
By using this site you agree to the license agreement. Webmaster contact