DirList PowerScript function
Description
Populates a ListBox with a list of files. You can specify a path, a mask, and a file type to restrict the set of files displayed. If the window has an associated StaticText control, DirList can display the current drive and directory as well.
Controls
ListBox, DropDownListBox, PictureListBox, and DropDownPictureListBox controls
listboxname
The name of the ListBox control you want to populate.
filespec
A string whose value is the file pattern. This is usually a mask (for example, *.INI or *.TXT). If you include a path, it becomes the current drive and directory.
filetype
An unsigned integer representing one or more types of files you want to list in the ListBox. Types are:
0 – Read/write files
1 – Read-only files
2 – Hidden files
4 – System files
16 – Subdirectories
32 – Archive (modified) files
16384 – Drives
32768 – Exclude read/write files from the list
To list several types, add the numbers associated with the types. For example, to list read-write files, subdirectories, and drives, use 0+16+16384 or 16400 for filetype.
statictext (optional)
The name of the StaticText in which you want to display the current drive and directory.
Return Values
Boolean. Returns true if the search path is valid so that the ListBox is populated or the list is empty. DirList returns false if the ListBox cannot be populated (for example, filespec is a file, not a directory, or specifies an invalid path). If any argument's value is null, DirList returns null.
Usage
You can call DirList when the window opens to populate the list initially. You should also call DirList in the script for the SelectionChanged event to repopulate the list box based on the new selection. (See the example in DirSelect.)
Note Alternatives
Although DirList's features allow you to emulate the standard File Open and File Save windows, you can get the full functionality of these standard windows by calling GetFileOpenName and GetFileSaveName instead of DirList.
Examples
This statement populates the ListBox lb_emp with a list of read/write files with the file extension TXT in the search path C:\EMPLOYEE\*.TXT:
lb_emp.DirList("C:\EMPLOYEE\*.TXT", 0)This statement populates the ListBox lb_emp with a list of read-only files with the file extension DOC in the search path C:\EMPLOYEE\*.DOC and displays the path specification in the StaticText st_path:
lb_emp.DirList("C:\EMPLOYEE\*.DOC", 1, st_path)These statements in the script for a window Open event initialize a ListBox to all files in the current directory that match *.TXT:
**桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......
我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......
關于MySQL的二進制日志(binlog),我們都知道二進制日志(binlog)非常重要,尤其當你需要point to point災難恢復的時侯,所以我們要對其進行備份。關于二進制日志(binlog)的備份,可以基于flush logs方式先切換binlog,然后拷貝&壓縮到到遠程服務器或本地服務器 ......