InstallShield 2019 » InstallScript Language Reference
Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the SetFileInfo function.
*
* SetFileInfo is called to set a file's date, time, and
* attributes.
*
* Note: Before running this script, create a file called
* ISExampl.txt in the root of drive C.
*
\*--------------------------------------------------------------*/
#define EXAMPLE_FILE "C:\\ISExampl.txt"
#define TITLE_TEXT "SetFileInfo Example"
#define NEW_FILE_DATE "2003/09/12"
#define NEW_FILE_TIME "18:30:00"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_SetFileInfo(HWND);
function ExFn_SetFileInfo(hMSI)
LIST listID;
begin
// Create a list to hold messages.
listID = ListCreate (STRINGLIST);
// If an error occurred, report it; then terminate.
if (listID = LIST_NULL) then
MessageBox ("Unable to create list required for this example.", SEVERE);
abort;
endif;
// Set the file's date.
if (SetFileInfo (EXAMPLE_FILE, FILE_DATE, 0, NEW_FILE_DATE) < 0) then
ListAddString (listID, "Unable to change the file\'s date.", AFTER);
else
ListAddString (listID, "File\'s date changed to" + NEW_FILE_DATE + ".",
AFTER);
endif;
// Set the file's time.
if (SetFileInfo (EXAMPLE_FILE, FILE_TIME, 0, NEW_FILE_TIME) < 0) then
ListAddString (listID, "Unable to change the file\'s time.", AFTER);
else
ListAddString (listID, "File\'s date changed to" + NEW_FILE_TIME + ".",
AFTER);
endif;
// Clear the file's attributes.
if (SetFileInfo (EXAMPLE_FILE, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, "") < 0)
then
ListAddString (listID, "Unable to clear file attributes.", AFTER);
else
ListAddString (listID, "File attributes cleared.", AFTER);
endif;
// Report the results.
SdShowInfoList (TITLE_TEXT, "Changes to " + EXAMPLE_FILE, listID);
// Remove the list from memory.
ListDestroy (listID);
end;
InstallShield 2019 Help LibraryApril 2019 |
Copyright Information | Flexera |