|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.|
The following function backs up existing files only if they have been changed from a previous installation. For this purpose it compares date and size information of the file in the target location and the version you are about to install. If they differ, a backup copy of the file is created.
This function is not compatible with IS6.
prototype BackupIfNeeded(STRING, STRING, STRING, STRING);
BackupIfNeeded.zip Written by Kristjan Hakonarson
File size: 1.095 bytes Last update: 03/16/1999
There is no current IS5 built-in capability for to backup replaced files. Here is a workaround for this defficiency. You must call this function for each filegroup in your setup. A sample rul file is included.
This function is not compatible with IS6.
prototype CompareBackupSharedFiles(STRING, STRING, STRING);
bkfile.zip (2727 Bytes) Provided by Jeff McCollum
This function will clone the timestamp (modified, last accessed and created) of a source file onto a target file. It was tested with IS6.31 but it should work with 5.5 and 7.0 as well.
CloneTimeStamp.zip Written by
File size: 729 bytes Last update: 2003-01-24
This is a collection of list related functions to manage components. Among others, there are functions copy and logical combine lists, translate compononents into lists and vice versa, etc.
lists.zip (2.588 Bytes) Provided by T.K.Wessing
Invisible components can only be (de)selected by being required components of visible components (the invisible components are then selected/deselected as a cascade from the visible component). The following function gets around this by temporarily making the component visible if it is invisible.
prototype _ComponentSelectItemForce ( STRING, STRING, BOOL );
componentselectitemforce.zip (1.056 Bytes) Provided by Carl Bennett based on a function by James Frater
This functions works similar to FindAllFiles, but it also deletes the files it found. It returns the fully-qualified path of the file it deleted for logging purposes.
prototype DeleteAllFiles(STRING, STRING, BYREF STRING, NUMBER);
deleteallfiles.zip (474 Bytes) Provided by Stefan Krueger
In contrast to DeleteFile, which wipes the file from the user's hard disk, this function will send a file to the recycle bin.
recycle.zip Written by Mike Mckee
File size: 485 bytes Last update: 05/16/1999
This script provides users with the functionality to move, copy, delete or rename directories (or files). It uses the exported function SHFileOperation from Shell32.dll.
prototype INT DirOperation( STRING, STRING, STRING );
DirOperations.zip Written by Rob Gommans
File size: 1.386 bytes Last update: 2000-09-04
This is a replacement for the HandleMoveDataError function in your script. It interprets the error numbers into English, based on the IS help. It also logs it in the Install.log file, and displays the error to the user. Currently it isn't using the string table. The error texts are hard coded in the script.
handlemovedataerror.zip (1.835 Bytes) Provided by William Randlett
This file searching function is a little different than FindAllFiles. There is an option for whether or not to search subdirectories. The files are returned in a list with their full path.
prototype GetFileList( STRING, STRING, BOOL, BYREF LIST );
getfilelist.zip (717 Bytes) Provided by Ryan Lewandowski
This script goes through the component tree and adds all the associated files to a string list. You can chose to list only files in selected components, or all files. The function does not take into account operating system or language filters.
This function is not compatible with IS6.
enumfiles.zip (1.650 Bytes) Provided by Richard Aquino, InstallShield Software Corporation
When you call ComponentGetData with COMPONENT_FIELD_DESTINATION, the returned string may include literal names of system variables like "<TARGETDIR>" or script defined folders. This function optionally expands those meta directory names to their actual values.
prototype _ComponentGetData ( STRING, LONG, BYREF LONG, BYREF STRING, STRING );
componentgetdata.zip (6.162 Bytes) Provided by James Frater
This function allows you to search the environment variable PATH for the occurance of a specified file.
prototype FindFileInPath(STRING, BYREF STRING);
findfileinpath.zip (1.720 Bytes) Provided by Stefan Paetow
This function gets the date and time of a file, either on disk or in a component, in a format suitable for before/after comparisons.
prototype GetFileDate (STRING, BYREF STRING);
filedate.zip Written by Alan Frank
File size: 1.038 bytes Last update: 03/16/1999
This function scans through a directory (and optionally its subdirectories) and adds up the size of all files that match the specified wild card. Note that this will be the sum of the bytes making up these files. The disk space actually occupied by these files can be significantly larger, depending on the cluster size of the file system.
prototype GetDirFileSize ( STRING , STRING , BYREF NUMBER , NUMBER );
Updated version: Now calls FindAllFiles with CANCEL to free file handles.
GetDirFileSize.zip From the
File size: 655 bytes Last update: 2000-02-01
This function inserts a text file into another text file at a specified line number. It was written for ISPro 6.
Written by Michael Steurich
File size: 1.059 bytes Last update: 2003-06-30
This script will see if a self-registered file is on the system and, if so, where it's located.
prototype _GetPathToSelfRegisteredFile( STRING, BYREF STRING );
SRCheck.zip (1.220 Bytes) Provided by Leslie Easter
This function can read verious data from the version info resource in a file, not just the file version. It is based on Microsoft's knowledge base article Q160042. Compatability: Windows 2000 and later. This works on 16-, 32-, and 64-bit file images. Tested with installshield 11 premier edition but should also be compatible to older InstallShield versions
VerGetFileProperty.zip Written by
File size: 32.358 bytes Last update: 2005-12-12
InstallShield's VerGetFileVersion function can be used to read the file version, but not the product version stored in the version information block of a file. Here is a script that calls WinAPIs to get the numerical ProductVersion stored in the VS_FIXEDFILEINFO structure. Note that files typically also include file and product versions as strings, that cannot be extracted with these functions. Windows Explorer only displays these version strings, not the numerical version info. (Execption: Windows 2000 Explorer displays the numerical file version. All other information - including product version - is still taken from the string file info.)
prototype VerGetProductVersion(STRING, BYREF STRING);
ProductVersion.zip Written by Mickey Ferguson and Rich Brady
File size: 2.574 bytes Last update: 2003-06-30
In IS6 script defined folders (like "<szVar>") are implemented using a service called TextSubstitution that is available in the script through the COM object named TextSub. When you do
ComponentSetTarget("", "<szVar>", "C:\\MyDir");
it finally ends up calling
TextSub.Value("szVar") = "C:\\MyDir";
The values of the TextSub object are automatically saved after the file transfer, and you can use TextDub to retrieve them. For example, if you want to display the last saved value of "szVar" in your OnBegin event handler you would do:
function OnBegin() begin if( MAINTENANCE ) then MessageBox(TextSub.Value("szVar"), INFORMATION); endif; end;
From newsgroup installshield.is6.general
Last update: 11/26/1999
The built in function FileInsertLine() sometimes failes without any obvious reason. This function works around that problem using a stringlist.
prototype MyFileInsertLine(STRING, STRING, NUMBER, NUMBER);
myfileinsertline.zip (439 Bytes) Provided by Stephan Hagedorn
This functions loads a file into memory, searches it for a given string and replaces all occurrences.
prototype FileStrReplace ( STRING, STRING, STRING );
filestrreplace.zip Written by Mark Kendzior
File size: 1.138 bytes Last update: 08/07/1999
Files that are locking during the setup will be updated on the next reboot. On Windows 9x/Me this is done using wininit.ini and the rename operation takes place on DOS level, without support for long file names. So if a file with long name is locked, it will end up with a name like longfi~1.dll. Windows NT/2000 and later are not affected by this problem.
If you can't avoid to use long file names for potentially locked files, you can use the following script to work around this problem. It works by checking for long filenames in Wininit.ini in the OnEnd event handler. If it finds any, it alters the rename entries to delete the in-use files by their short names on next reboot and also copies the original rename entry into LongInit.ini. The OnRebooted event handler then completes the rename operation by processing the entries in LongInit.ini.
It's only potential drawback is if any locked files are used between the time Windows deletes them and the time the setup re-starts.
This script will not work with IS5.
LockedLongNames.zip Written by John Biddle
File size: 1.061 bytes Last update: 2002-02-02
|News||Discussions||Windows Installer||Related Tools||More Help||InstallScript||About InstallSite||Shop||Site Search|
|Neuigkeiten||Diskussionsgruppen||Windows Installer||MSI FAQ||Artikel||Shop||Suche|
Copyright © by InstallSite Stefan
Krueger. All rights reserved. Legal
By using this site you agree to the license agreement. Webmaster contact