In a Gen 8.6 GUI window, what action diagram statements or functions can be used to determine if a Windows folder already exists?
Gen 8.6 Workstation Toolset
Gen 8.6 GUI Window applications
Gen does not have any built-in functions to address folders or directories. But, a GUI object can be created that has folder function methods/properties. The following is a step by step process to determine if a folder exists.
Step 1. Open a action diagram and create a attribute with the domain of GUI Object.
Step 2. Create a action diagram statement that creates the object. Create the SET as shown below and then select Application Object.
Step 2a. In the OLE Object Browser, highlight CreateObject and then click OK.
Step 2b. In the Add Statement box, select char string.
Step 2c. In the Character String box, type Scripting.FileSystemObject and then click OK.
Step 2d. In the Add Statement box, click <complete> and then click Add.
Step 2 complete. The following shows the completed action diagram statement.
Step 3. Create a action diagram statement to test if the folder exists. Create the IF statement as shown below and then select Objects.
Step 3a. In the OLE Object Browser, change the Library drop down and select Microsoft Scripting Runtime, then highlight Object FileSystemObject, then highlight Method/Property FolderExists and then click OK.
Step 3b. Next, a character string or a character view can be selected. If the character view is chosen, at runtime it must contain the full directory path to folder that is being tested. For this example, char string was selected.
Step 3c. The box below shows a character string of a directory that will be tested at runtime, and then click OK.
Step 3d. In the Add Statement box, choose an expression. For example, IS EQUAL TO.
Step 3e. In the Add Statement box, choose char string, type True (or False) which is case sensitive, and the click OK. Then click Add.
Both Steps completed. The following shows the action diagram statements that will create a GUI object to FolderExists and set an IF to test for a directory.
These action diagram statements give the base for testing whether a folder/directory exists. It can be modified to fit specific needs.