The script file with the function GetListOfFiles was updated on 2009-02-10.
I have changed slightly all variable names by adding a prefix letter for the type of the variable. Advantages of using a type prefix letter:
- The type of a variable is always visible which is a great help.
- No problem anymore with variable names similar common words used in comments or strings, especially for searching/replacing such variables. For example sDirectory as variable name is much better than just Directory because word Directory can also exist in comments and strings.
- It is easy to search for all string, number or boolean variables if using a type prefix letter (always lowercase) and the variable name starts with an uppercase character. For example the case sensitive regular expression search string s[A-Z][A-Za-z]+ with option Match Whole Word Only finds all string variables in the script file.
- Using type prefix letters makes the selection of an existing variable of type string, number or boolean easier in the auto-complete dialog.
Additionally the global variable used is now named
g_nDebugMessage.
g_ as additional prefix defines that this variable is a global variable not defined inside the function. Variables with a non standard type don't have a prefix, but have a very special name.
The standard prefixes I use are:
an ... array of numbers (doesn't exist in GetListOfFiles.js)
as ... array of strings (doesn't exist in GetListOfFiles.js)
b ... boolean
n ... number
s ... string
Further I have fixed a wrong type verification of input variable
nFileList at top of the function resulting in running the function always with value 0 for the first input parameter (= find files in a specified directory or directory tree).
The next small mistake was that there was only 1 error message if no file could be found. This error message was correct only for running the function to get a list of files in a specified directory or directory tree. I have added now 4 additional error messages for that case depending on the input parameter
nFileList.
Last I have added a code for demonstrating the usage of the function. So it is now possible to simply run the script which asks the user which file list shall be created and the optional parameters depending on the first choice for the type of the file list.