TPF/GI script dialog boxes debut
TPF/GI version 2.4.1 introduced scripting—a way for users to automate the testing they do in TPF/GI. Now TPF Software has released a new product, ScriptDialogs, that lets script writers include versatile dialog boxes in their scripts.
Why dialog boxes?
Readers who have not written scripts for a graphical user interface (GUI) such as TPF/GI, probably have written command-line scripts such as REXX scripts or Execs. To see how important dialog boxes are to GUI scripts, imagine what it would be like if a command-line script could not accept any parameters or user input and could not print any output.
Dialog boxes are the way that GUI scripts accept input and display output.
Clearly, such a script is pretty limited: it always has to do the same things in the same order. And it can?t give any feedback to the user. It?s true that there are useful scripts that can be written within these constraints, but scripts that interact with the user are much more versatile.
Because dialog boxes are the way that GUI scripts accept input and print output, for many tasks they are indispensable.
A dialog box example
The script in Listing 1 shows how to create a dialog box, execute it, and process the result using ScriptDialogs.
Where to get ScriptDialogs
ScriptDialogs will be distributed with TPF/GI 2.5.1, but will work with version 2.4.1 as well. It can be downloaded from http://www.tpfsoftware.com/products/scriptdialogs.html. It must be installed on machines where it is used.
Listing 1
Listing 1: A dialog box lets users select the 3270 terminal, the ALC, or the PrimeCRAS. A message box displays the choice they have made.
Sub main
' Create the dialog box object.
' This must always be done before using the dialog.
Set Dialog = CreateObject("TPFSoftware.ScriptDialog")
' Place instructional text in the dialog box
Dialog.AddText "Please select a terminal", 1
' Place three radio buttons in the dialog box
' "terminal" is the name of the group of radio buttons
' "Choices:" is the label for the radio buttons
' "3270" sets the default radio button
Dialog.AddRadios "terminal", "Choices:", _
Array("3270", "ALC", "PrimeCRAS"), "3270"
' Place OK and Cancel push buttons in the dialog box
' "button" is the name of this group of push buttons
Dialog.AddButtons "button", Array("OK", "Cancel")
' Display the dialog box and wait for the user to act
' "Result" is an object that receives information
' about what actions the user took.
Set Result = Dialog.Execute
' Use a message box to report what choice was made
If Result.ValueOf("button") = "OK" Then
MsgBox "You selected " & Result.ValueOf("terminal")
Else
MsgBox "You cancelled the dialog box"
End If
End Sub

Figure 1: The dialog box created by the script in Listing 1.
|