Workplace Shell Example: Creating Folders

Here is a simple example showing how to create a folder and add objects to it:

/* Add the workplace constants to the global environment         */
call wpconst

/* Create a new folder with title 'My Folder' on the desktop     */
newfolder = .wpfolder~new('My Folder','',.wpdesktop,1)

You may have to rearrange your windows a little bit to make the new folder's icon visible.

/* Send a message to the new folder object and show the result   */
say newfolder~wpquerytitle

/* Change the title of the new folder                            */
newfolder~wpsettitle('My Excellent Folder')

/* Add a program object to the new folder                        */
.wpprogram~new('REXXTRY','EXENAME=pmrexx.exe;PARAMETERS=REXXTRY',newfolder,1)

/* Open the new folder and make it current                       */
newfolder~~wpopen(0,.wpconst['OPEN_DEFAULT'],0)~wpswitchto(0)

Now double click the REXXTRY icon to verify that the program was added correctly and works as expected.

/* All done, close the folder                                    */
newfolder~wpclose


[Back: Accessing Workplace Shell Objects]
[Next: A Workplace Shell Example: Animated Icons]