|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > FIL. - File-Commands > FIL.DIR-Commands > FIL. - File and Directory Commands |
SPR Script Language
FIL.ArrayToVar
Converts a result array into a single, CR-LF delimited variable.
Intention
After using a command like FIL.DIRF to populate a global array with a list of files, you often need to view or process that list as a whole. The FIL.ArrayToVar command is a utility that takes all the elements from a specified array (starting from index 1) and joins them together into a single string variable, with each element separated by a newline (`$crlf$`).
This is perfect for displaying results in a message box, writing them to a log file, or passing the entire list as a single parameter to another command.
Illustration
📎 Paperclip: This command takes a stack of individual pages (the array elements) and clips them together into a single, easy-to-handle report (the string variable).
Syntax
FIL.ArrayToVar|Array-No.|$$DestVar
Parameter Explanation
P1 - Array-No. - (Numeric, Required)
The number (0-32) of the source global array.
P2 - $$DestVar - (Variable, Required)
The variable where the final, CR-LF delimited result string will be stored.
Examples
'***********************************
' FIL.ArrayToVar - Sample 1: Displaying Directory Scan Results
'***********************************
' First, get a list of files into Array 1
FIL.DIRF|?path\|1|*.inc
' Now, convert that array into a single string variable
FIL.ArrayToVar|1|$$res
' Display the results in a message box
MBX.Found INC files:$$crlf$$$$res
ENR.
'
Remarks
- This command specifically skips element 0 of the source array. This is by design, so it does not include the summary data from FIL.DIR* commands in the output string.
- The command does not return a value on the stack.
See also:
• FIL.DIRF