CFileDlg:Next
The Next method returns the next file name in the list of names returned by the Open method. This is an iterator to fetch the next name in a list. The iteration must be started using the Start method.
sFileName = CFileDlg:Next() sFileName is the returned path string for the file. When done, nil is returned. |
This method advances to the next file name and returns it. If another file name is found, the full path (machine, drive, folder, file name, and extension) is returned. If no more file names are found, nil is returned. The search must have been initialized using the Start method before Next is called. The returned file names might be used immediately or be stored in an indexed table for later use. The example below stores the values in an indexed table from which you can later fetch the n-th file name using FileName[i].
The following example uses Next to loop over 100 files and store the returned file names in a table:
|
-- create a CFileDlg object
|
|
-- set the flag for selecting more than 1 file |
|
-- allow selecting up to 100 files |
|
-- get a file name |
|
-- create a table to hold the file names |
|
-- setup an index counter |
|
-- initialize the file name iteration |
|
-- loop until a nil file name is returned |
|
-- save the next file name |
|
-- exit the loop when a nil file name is returned |
|
-- save the file name in the table |
|
-- increment the table index |
|
|
-- next statement following the loop |
|
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.