Using the Display Interface
BlueZone Scripts support the ability to create up to four variables that can be utilized in a BlueZone script.
There can be many uses for variables. For example, if you wanted to create a BlueZone script (.bzs) to automate the log on process for several host systems, or log on to several sessions on the same host, you can create a BlueZone script with a variable for Username (InputStr1) and a variable for Password (InputStr2) by using BlueZone's "Input" script event. Then the script will pass the values of InputStr1 and InputStr2 to additional host sessions via BlueZone's command line switch feature, and use the stored values to automatically log on to additional hosts.
The following BlueZone Scripting Exercise assumes that you are already familiar with BlueZone and somewhat familiar with BlueZone Scripting.
In this exercise, we will be creating a BlueZone script that will prompt the End User for Username then Password, then use the values of Username and Password to log onto an iSeries host. Then, the script will automatically launch a second iSeries host session, and pass the values of Username and Password to the second iSeries host session. A script will automatically run on the second iSeries host which will use the values of Username and Password to log onto the second host.
By using this technique, the End User will be prompted to enter their Username and Password only once, at the very beginning of the script, and the script will insert the Username and Password values at the correct point for each host.
Launch two BlueZone iSeries display sessions.
Configure the sessions to connect to the same or two different iSeries hosts.
Save the first session to a file called session1.zad
Save the second session to a file called session2.zad.
Launch the BlueZone Script Editor, and start creating a new script as follows:
Locate the Script Event called Input and double click. The Input dialog will display.
Type InputStr1 in the Title box, followed by the text that you want to appear when the End User is prompted, as shown in the following example:
Click the OK button to enter this event into the script.
Repeat the process to create an input box for the End Users Password as shown here. Don't forget to check the "Hide Input as User Types" checkbox.
Click the OK button. So far, your script will look like this:
In order to send the value of InputStr1 to the host, you use the Type event. Locate the Type event in Script Events, and double click. The Type dialog will display.
Enter InputStr1 and click the OK button to add it to the script as shown above:
The next step in the log on process is to send a Tab function. This will advance the cursor to the Password field.
To add a Tab to the script, find the Tab / Field Advance function under LU Functions, and double click. This will add the Tab / Field Advance function to the script.
The next event is to pass the value of the End User's Password. This is accomplished by sending a Type "InputStr2" to the host, in the same way we sent the value of Username above.
Locate the Type event in Script Events, and double click. The Type dialog will display.
Enter InputStr2 as shown above:
Be sure to check the "Encrypt and Hide" checkbox as shown here:
Click the OK button to add it to the script as shown below:
The final step in the log on process is to send an Enter function. This will complete the log on sequence.
To add an Enter function to the script, find the Enter function under LU Functions, and double click. This will add the Enter function to the script as shown:
The next step in the process is to launch a second iSeries display session. This is accomplished by using the Run event. We will create a Run event that will call the correct program, and use command line switches to set the configuration file to use, and to pass along the InputStr1 and InputStr2 values to the second iSeries session.
In the Script Events, locate the Run event and double click. The Run dialog will be displayed.
Enter the following command line:
C:\Program Files\SEAGULL\BlueZone\BZAD.EXE /Fsession2.zad /1InputStr1 /2InputStr2
As shown here:
Click the OK button to enter this event into the script.
This command line, will launch a BlueZone iSeries display session, use the configuration file named session2.zad, and send the values of InputStr1 and InputStr2 to the new iSeries session. Your script will look like this:
Save the script and name it script1.bzs
So far, we have created a script that will prompt the End User for Username and Password, automatically log on to an iSeries session using the stored values of Username and Password, and automatically launch a second iSeries session.
The next step is to create a second BlueZone script that will use the values of InputStr1 and InputStr2 from the first script, to automatically log on to the second iSeries host.
Create a second BlueZone script by selecting New from the BlueZone Script Editor Menu. You now have a blank screen in which you can create a new script.
It's a good idea to start with a Wait event in order to give the new session some time to bring up the main log-in screen. I chose to use a two second wait as shown here:
Locate the Type event in Script Events, and double click. The Type dialog will display.
Type Var1 as shown here:
Click the OK button to add this to the script.
So far, your script will look like this:
Next, enter a Tab / Field Advance function followed by a Type Var2 event followed by an Enter function so that your finished script looks like this:
Save this script and name it script2.bzs.
We will need to configure the second iSeries session to automatically launch this script upon connection to the host, which will use the value of Var1 for the Username, and the value of Var2 for the Password.
NOTE Var1 relates to the \1InputStr1 and Var2 relates to the \2InputStr2 that is used in the command line switch that launched the second iSeries display session.
Launch the second iSeries display session.
Select Script:Properties from the BlueZone MenuBar.
Check the "Auto-Play Script on Connect" checkbox.
Click the Browse button.
Select the script2.bzs file and click the Open button.
Click the OK button to exit this dialog.
Save the iSeries configuration. Make sure you save it as session2.zad.
At this point you are ready to test the completed script.
To test the script, start the first iSeries session and connect to the host.
Select Script:Play from the BlueZone MenuBar.
Select the script1.bzs file and click the Open button. The script will immediately start running. You will be presented with the following Enter Username dialog:
Enter your Username and press the Enter key.
You will be presented with the following Enter Password dialog:
Enter your Password and press the Enter key.
The script will continue to run, and you will be logged onto the host, then the second iSeries session will launch, and you will be logged onto the second host.
You can assign the script1 to a BlueZone Power Key - This makes it much easier for the End User to launch a script. Mapping a Script to a Power Key.
You can adjust the speed of the script playback - When you are developing a script, sometimes it's helpful if the script runs at a slow speed so you can see exactly what is happening.
Speed up the script and turn off the Script Status Window - Once the script is completely de-bugged and working properly, you may want to speed up the script execution speed and also turn off the Script Status Window. This is done by selecting Script:Properties... from the BlueZone MenuBar and making any desired changes.
SEE Script Properties Dialog for more information.