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, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please 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 December 09 2017 at 9:30am
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.