CAS 6


StringList save to text file

Scripting StringListSaveAs method will write out each collection item to a UTF-8 text file. Each item will be on its own line.

Arguments

Argument Data Type Description
filePath CharString Text file save path.
ovewrite Boolean 1 (True) overwrite file. 0 (false) append to current file or create if it does not exist.
wizProg WizProgress Optional reference to an instance of WizProgress object.

Example

Without a progress bar.

 filePath←CharString.New'c:\temp\slout.txt'
 sl←StringList.New''
 sl.AddString'Line 1'
 sl.AddString'Line 2'
 sl.Add CharString.New'Line 3'
 sl.SaveAs filePath 1

With a progress bar.

sl ← StringList.New '' 
sl.AddString'Line 1' 
sl.AddString'Line 2' 
sl.Add CharString.New 'Line 3' 
sl.Show''
 
filePath ← CharString.New 'c:\temp\slout.txt' 
 
W←Wizard.New ''  
W.Start 0  
P←WizProgress.New W  
P.Messages ← 1
P.Run ''
P.Subtitle← 'Write out list...' 
sl.SaveAs filePath 1 P 
P.Wait 0  
P.End '' 

Output file.