ScriptPro Editor

This topic is for use by scriptwriters who are using ScriptPro Editor to create custom scripts for their agencies.

Agents can go to Using ScriptPro Scripts for more information about using custom or standard scripts within Travelport Smartpoint.

 

Button Controls

Button controls are used to immediately perform particular actions and are optional in script dialog boxes. The button types include:

  • OK
  • Abort
  • Command
  • Document / Open Files

Note: All buttons can be re-sized.

Reminder: With static controls, adding an ampersand (&) prior to a specific character in a text string causes that character to be underlined on the face of the button (e.g., &Hotel appears in the button as Hotel).

OK and Abort button controls

The OK button acts as <Enter> and accepts the data in the dialog box.

The Abort button acts as <Esc>, closes the dialog box and aborts the script after confirming the abort command.

Creating an OK button and associated attributes

  1. Right-click anywhere in the background of the dialog box.

  2. Select Button. A new control will be added.

  3. Button type will default to OK. Use the drop-down list to select a different type.

  4. Change the button text by modifying the Text section under Appearance. The variable for all buttons is $StrButton and cannot be changed. The button size and location on the screen can be changed in the Layout section.

Document Button used to Open Files or Web Page

The button Document opens a specified file. Any file type can be opened with the associated program. The path of the applicable text file is required in the file name and you can browse for the file location. The path location must match the location where the file can be found on the user’s computer.

Note: To properly test the Document button, the script needs to be compiled and tested live.

An example of a Button Document used to open a URL appears below.

   

Dynamic File Names

The Document button allows a dynamic file name to be inserted. Code needs to be written to handle the variable associated with the Document button. The variable must begin with $ and be inside the parenthesis in the file name box, e.g., $(variable).

For all variables used as list file, image, or button, the following order determines how the value is handled.

  1. Determines if this is a URL by looking at https:// or http://

  2. Looks for an absolute path, e.g., C:\

  3. Looks in the Prod folder.

  4. Looks in the File folder. If none are found, for URL or file, the shell is launched and displays as supplied by the launched program. If there is an image, there will be no image displayed in the dialog box. For a list file, you get an error message in the list box.

Note: The variable will not be automatically declared when the dialog box is transferred into the code.

In the example below, the file name is $(MyDocument).

A dynamic list file:

A dynamic image file:

The associated code would be similar to the following.

VARIABLES

RET_CODE=0

airline = ""

Options = ""

MyListFile = ""

$StrButton = ""

LaunchURL = ""

filenumber=""

MyDocument = ""

ROUTINES

BEGIN

 

//Image - the image is stretched into the box as declared in the dialog box.

  filenumber="02"

  airline="Block" + filenumber +".bmp"

 

//List file - the height and width of the list file are set in the dialog box and will not autosize.

  filenumber="13"

  MyListFile="Z4SFLT" + filenumber + ".LST"

 

//Launch Web page from button

  LaunchURL=https://Travelport.com

 

//Open Document from button

  MyDocument="C:\Windows\Enterprise.xml"

 

DIALOG ("TestImageWithVariable.dlg" , RET_CODE, $StrButton )

 

END

ENDS

Command button

The Command button allows instant selection of an item from a dialog box. Code will need to be written to handle the variable $StrButton associated with the command button. The variable value is the text from the selected button. For example, in the box below, your code would read something like this.

IF ($StrButton==”DDL Options”)THEN

GOSUB(GetOptions)

ENDIF

If the dialog box ends by other means, the variable $StrButton is cleared.

See the Command button example below.