LogReadCustomString Example

InstallShield 2016 » InstallScript Language Reference

Project • This information applies to InstallScript projects.

//---------------------------------------------------------------------------

//

//  InstallShield Example Script

//

//  Demonstrates the LogWriteCustomString, LogWriteCustomNumber,

//  LogReadCustomString, and LogReadCustomNumber functions.

//

//---------------------------------------------------------------------------

 

//  during installation, write some custom data to the log file

function OnMoved( )

    LIST listDrives;

    NUMBER nDriveCount, nvIgnore;

    STRING svDate;

begin

 

if (!MAINTENANCE) then

    // get current date

    GetSystemInfo(DATE, nvIgnore, svDate);

 

    // get current count of available drive letters

    listDrives = ListCreate(STRINGLIST);

    GetValidDrivesList(listDrives, -1, -1);

    nDriveCount = ListCount(listDrives);

    ListDestroy(listDrives);

 

    // write custom data to .ilg log file

    LogWriteCustomString("InstallDate", svDate);

    LogWriteCustomNumber("DriveCount", nDriveCount);

endif;

 

end;

 

 

// during a complete uninstallation, read custom data back from the log file

function OnMoving( )

    NUMBER nvDriveCount;

    STRING svInstallDate;

begin

 

if (REMOVEALLMODE) then

    LogReadCustomNumber("DriveCount", nvDriveCount);

    LogReadCustomString("InstallDate", svInstallDate);

    SprintfBox(INFORMATION, "Custom Log Data",

        "During installation, the drive count " +

        "was %d, and the date was %s.",

        nvDriveCount, svInstallDate);

endif;

 

end;