CFileList:Next CFileList:Start

CFileList:Open


The Open method attaches a file list to the CFileList object. THis may be used to open a new file list into the existing CFileList object, or it may be used to attach a file list when the CFileList object was created without specifying the file name. Note that Open is automatically called when the CFileList object is created with a file specified.

Syntax

bSuccess = CFindFiles:Open( sFileName )

bullet.gif    sFileName is the name of the file containing the file list.

bullet.gif    On success, bSuccess is returned as true.

Remarks

Call this method to attach a new file list to the existing CFileList object. The files can be collected by iterating over the list using Next. Usually, the file list is passed to the new constructor. After you have exhausted the list, you can restart the iterator by calling Start.

Example

The following script lists files from a file list in the file named sFileList. First, it creates an empty CFileList object that is not attached to a file. The file containing the file list is then attached using the Open command. Note that Next returns the next file name as a string, so you should not hide its return value by using it as a loop counter.

F = new_filelist()

-- Create a empty CFileList without a file name

F:Open( sFileName )

-- specify the name of the file list

for n = 1, F:Count() do

-- step through the files

  Printf("%s\r\n", F:Next() )

-- get the next file name

end

 

Related Topics

CFileList, new_filelist, Next, Start


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.