Summary: It's easy to get your folders' "Tree View" to show all objects. Dirk shows you how, using a Rexx script by Marco Steinbach
Marco Steinbach sent me a cool little Rexx script this month and I thought I would share it with you. As you know, the WPS Folder has three views for displaying its contents: Icon view where objects are displayed as independent icons, Details view where objects are displayed in rows with information like size, creation date and so on, and Tree view where objects are displayed as a connected tree with folders leading to deeper branches.
The Tree view is similar to the view displayed by the File Manager of Windows 3.1 and Windows Explorer in Win 95/98/NT. However, by default the Tree view in a WPS folder shows only Folder objects. To see the Program objects in a folder, you would have to open the Folder object in Icon or Details view. The ability to display other objects is built into the Tree view, however, and Marco's script shows how to enable it.
The key to this script is the SysCreateObject function in the RexxUtil library. The calling form of this function is as follows:
For a given folder, Marco calls SysCreateObject like so:
rc = SysCreateObject("WPFolder",FolderName,FolderLocation, "ALWAYSSORT=YES;ICONVIEW=NONFLOWED, MINI;MENUBAR=NO;SHOWALLINTREEVIEW=YES", "u")(I have broken the code across multiple lines here to make it more readable, but it would all be on one line in your script.)
The key element in the setup string is the SHOWALLINTREEVIEW=YES entry. That is the setting that forces the display of all objects in Tree view.
For this setting to be most useful, you need to set the SHOWALLINTREEVIEW setting for all of the subfolders of the current folder as well. Otherwise when you expanded a subfolder it would only show its folder objects. So, we need to get a list of of the folders underneath the given one. Another RexxUtil function makes that pretty easy: SysFileTree. We used this function previously in our recursive delete script. In that script we needed a list of files to be returned. Here we need a list of directories but that requires only a small change in the function call:
rc = SysFileTree(Folder'\*', 'Files','DSO')Recall that the calling form for SysFileTree is
SysFileTree(Mask, Results, Attributes)where Mask is the selection mask (like *.txt), Results is a stem variable that holds all of the objects that match the search criteria, and Attributes allows you to specify things about the search's scope (current directory or subdirectories, files only, directories only, etc.). In Marco's script, the variable Folder holds the path of the directory we are working on and he adds "\*" to that all objects will match regardless of their names. The variable Files is the stem variable that holds the results. And the attribrutes are set to look only for directories (D), scan subdirectories (S), and report only fully qualified path names (O). Once this call is made, Files will contain a list of all the subfolders of the directory we are working on. Now all we have to do is loop through all of them and call SysCreateObject to update them with the SHOWALLINTREEVIEW=YES attribute. Marco's code loop looks like this:
DO I = 1 TO Files.0 Folder = Files.I FolderLocation = Folder FolderLocation = LEFT(FolderLocation, LASTPOS("\", FolderLocation)-1) IF LENGTH(FolderLocation)=2 THEN FolderLocation = FolderLocation'\' FolderName = SUBSTR(Folder, LASTPOS("\", Folder)+1) Call DispStat rc = SysCreateObject("WPFolder", FolderName, FolderLocation, "ALWAYSSORT=YES;ICONVIEW=NONFLOWED,MINI;MENUBAR=NO;SHOWALLINTREEVIEW=YES", "u") IF rc \=1 THEN SAY 'Folder could not be updated ...' ENDThe call to routine DispStat displays a nice progress bar showing how far along the script is in its processing. I thank Marco for sending his script to me and if you have a script that you think would be educational and useful for others, please let me know.
|Copyright © 1999 - Falcon Networking||ISSN 1203-5696||June 1, 1999|