Using the Display Interface


BlueZone Scrips

Using Variables in a BlueZone Script

BlueZone Scripts support the ability to create up to four variables that can be utilized in a BlueZone script.

Uses

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.

BlueZone Script Exercise

The following BlueZone Scripting Exercise assumes that you are already familiar with BlueZone and somewhat familiar with BlueZone Scripting.

Exercise Overview

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.


Prepare Two BlueZone iSeries Display Sessions
  1. Launch two BlueZone iSeries display sessions.

  2. Configure the sessions to connect to the same or two different iSeries hosts.

  3. Save the first session to a file called session1.zad

  4. Save the second session to a file called session2.zad.


Create the First BlueZone Script
  1. Launch the BlueZone Script Editor, and start creating a new script as follows:

  2. Locate the Script Event called Input and double click.  The Input dialog will display.

  3. 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:

  1. Click the OK button to enter this event into the script.

  2. 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.

  1. Click the OK button.  So far, your script will look like this:

  1. 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.

  1. Enter InputStr1 and click the OK button to add it to the script as shown above:

  2. The next step in the log on process is to send a Tab function.  This will advance the cursor to the Password field.

  3. 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.

  4. 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.

  5. Locate the Type event in Script Events, and double click.  The Type dialog will display.

  1. Enter InputStr2 as shown above:

  2. Be sure to check the "Encrypt and Hide" checkbox as shown here:

  1. Click the OK button to add it to the script as shown below:

  1. The final step in the log on process is to send an Enter function.  This will complete the log on sequence.

  2. 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.

  1. In the Script Events, locate the Run event and double click.  The Run dialog will be displayed.

  2. Enter the following command line:

C:\Program Files\SEAGULL\BlueZone\BZAD.EXE /Fsession2.zad /1InputStr1 /2InputStr2

As shown here:

  1. 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:

  1. Save the script and name it script1.bzs


What We've Accomplished So Far

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 the Second BlueZone Script
  1. 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.

  2. 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:

  1. Locate the Type event in Script Events, and double click.  The Type dialog will display.

  2. Type Var1 as shown here:

  1. Click the OK button to add this to the script.

  2. So far, your script will look like this:

  1. 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:

  1. 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.


Configure the Second iSeries Session to Automatically Launch Scritpt2.bzs
  1. Launch the second iSeries display session.

  2. Select Script:Properties from the BlueZone MenuBar.

  3. Check the "Auto-Play Script on Connect" checkbox.

  4. Click the Browse button.

  5. Select the script2.bzs file and click the Open button.

  6. Click the OK button to exit this dialog.

  7. Save the iSeries configuration.  Make sure you save it as session2.zad.


Testing the Script

At this point you are ready to test the completed script.

  1. To test the script, start the first iSeries session and connect to the host.

  2. Select Script:Play from the BlueZone MenuBar.

  3. 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:

  1. Enter your Username and press the Enter key.

  2. You will be presented with the following Enter Password dialog:

  1. Enter your Password and press the Enter key.

  2. 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.


TIPS

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.