MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Open File via VBSCRIPT CA[Next]: Registry Appending
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->File and Directory->Read a file List

Read a file List

This demonstrates how you could read a file which lists the actual filenames of files you'd like to include in the msi:

<$DirectoryTree Key="INSTALLDIR" Dir="c:\tmp\aaa" CHANGE="\" PrimaryFolder="Y">
<$ListLoad "TestList.txt" ARRAY="FileList">     ;;Load the file that ists the files we want to include
#{  FOR @@Index = 1 to FileList.0
    <$File Source="<??FileList.@@Index>" Destination="[INSTALLDIR]\">
#}

The is the reusable code that the above example uses:

#(
    ;--- Simple "stub" to call the rexx code --------------------------------
    #define ListLoad                            ;;Version 07.111
    #evaluate ^^ ^<$@@Rexx4ListLoad {$?}>^
#)
#DefineRexx '@@Rexx4ListLoad'         ;;The rexx code
    ;--- Work through the file ----------------------------------------------
    {$!:#1,ARRAY}                     ;;List valid parameters
    @@ListFile = '{$#1}';             ;;Get passed filename
    @@FileCnt  = 0;
    call FileClose @@ListFile, 'N';
    do  while lines(@@ListFile) <> 0
        ;--- Read next line of the file -------------------------------------
        @@Line = linein(@@ListFile);

        ;--- Lets allow some flexability with contents ----------------------
        @@Line = ReplaceString(@@Line, '09'x, ' ');
        @@Line = strip(@@Line);

        ;--- Save the value -------------------------------------------------
        if  @@Line <> '' then
        do
            ;--- Looks OK ---------------------------------------------------
            @@FileCnt          = @@FileCnt + 1;
            {$Array}.@@FileCnt = @@Line;
        end;
    end;
    call FileClose @@ListFile;
    {$Array}.0 = @@FileCnt;
#DefineRexx


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 15 Nov 2008Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Open File via VBSCRIPT CA[Next]: Registry Appending


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday November 15 2008 at 2:05pm
Visit MAKEMSI's Home PageThis external link was OK when tested at 7 Nov 2008

HTML page dated Mon, 29 Jan 2007 00:11:11 GMT
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 15 Nov 2008