Basic Script Users Guide EP-DSX756
Basic Script Users Guide EP-DSX756
User's Guide
EP-DSX756
R400
March 2010
Release 400
Honeywell
Notices and Trademarks
While this information is presented in good faith and believed to be accurate, Honeywell disclaims
the implied warranties of merchantability and fitness for a particular purpose and makes no
express warranties except as may be stated in its written agreement with and for its customers.
In no event is Honeywell liable to anyone for any indirect, special or consequential damages. The
information and specifications in this document are subject to change without notice.
Release Information
Document Name Document ID Release Publication
Number Date
Document Category
Configuration
Pacific
Contact: Honeywell Global TAC – Pacific
Phone: 1300-364-822 (toll free within Australia)
+61-8-9362-9559 (outside Australia)
Fascimile: +61-8-9362-9564
Mail: Honeywell Limited Australia
5 Kitchener Way
Burswood 6100, Western Australia
Email: GTAC@honeywell.com
India
Contact: Honeywell Global TAC – India
Phone: +91-20- 6603-9400
Fascimile: +91-20- 6603-9800
Mail: Honeywell Automation India Ltd
56 and 57, Hadapsar Industrial Estate
Hadapsar, Pune –411 013, India
Email: Global-TAC-India@honeywell.com
Korea
Contact: Honeywell Global TAC – Korea
Phone: +82-80-782-2255 (toll free within Korea)
Fascimile: +82-2-792-9015
Mail: Honeywell Co., Ltd
4F, Sangam IT Tower B4-4 Block
1590, DMC Sangam-dong, Mapo-gu
Seoul, 121-835, Korea
Email: Global-TAC-Korea@honeywell.com
Singapore
Contact: Honeywell Global TAC – South East Asia
Phone: +65-6580-3500
Fascimile: +65-6580-3501
+65-6445-3033
Mail: Honeywell Private Limited
Honeywell Building
17, Changi Business Park Central 1
Singapore 486073
Email: GTAC-SEA@honeywell.com
Taiwan
Contact: Honeywell Global TAC – Taiwan
Phone: +886-7-536-2567
Fascimile: +886-7-536-2039
Mail: Honeywell Taiwan Ltd.
17F-1, No. 260, Jhongshan 2nd Road.
Cianjhen District
Kaohsiung, Taiwan, ROC
Email: Global-TAC-Taiwan@honeywell.com
Japan
Contact: Honeywell Global TAC – Japan
Phone: +81-3-6730-7160
Fascimile: +81-3-6730-7228
Mail: Honeywell Japan Inc.
New Pier Takeshiba, South Tower Building,
20th Floor, 1-16-1 Kaigan, Minato-ku,
Tokyo 105-0022, Japan
Email: Global-TAC-JapanJA25@honeywell.com
Elsewhere
Call your nearest Honeywell office.
http://www.honeywell.com/ps
Training Classes
Honeywell Automation College:
http://www.automationcollege.com
Symbol Definitions
The following table lists those symbols used in this document to denote certain conditions.
Symbol Definition
Symbol Definition
Help Menu............................................................................................................................55
Contents
• Script Editor Basics
• Editing Your Scripts
• Running Your Scripts
• Debugging Your Scripts
• Exiting from Script Editor
• Menu Reference
• Status bar: displays the current location of the insertion point within your script.
Toolbar
The following list briefly explains the purpose of each of the tools on Script Editor's
toolbar. These tools are discussed in more detail later in the chapter, in the context of the
procedures in which they are used.
Tool Function
Cut Removes the selected text from the script and places it
on the Clipboard.
Add Watch Displays the Add Watch dialog box, in which you can
specify the name of a BasicScript variable. That variable,
together with its value (if any), is then displayed in the
watch pane of Script Editor's application window.
Single Step Executes the next line of a BasicScript script and then
suspends execution of the script. If the script calls
another BasicScript procedure, execution will continue
into each line of the called procedure.
Tool Function
Procedure Step Executes the next line of a BasicScript script and then
suspends execution of the script. If the script calls
another BasicScript procedure, BasicScript will run the
called procedure in its entirety.
TIP
If you forget the name of a toolbar tool, pass the pointer over the tool to
display its name
Keyboard Shortcuts
The following lists present various types of keyboard shortcuts, including general
shortcuts, navigating shortcuts, editing shortcuts, and debugging shortcuts.
General Shortcuts
Key(s) Function
Ctrl+F Displays the Find dialog box, which allows you to specify text
for which you want to search.
Navigating Shortcuts
Key(s) Function
Left arrow Moves the insertion point right by one character position.
Right arrow Moves the insertion point left by one character position.
Key(s) Function
Ctrl + Left arrow Moves the insertion point to the start of the next word to the
left.
Ctrl + Right arrow Moves the insertion point to the start of the next word to the
right.
Home Places the insertion point before the first character in the line.
End Places the insertion point after the last character in the line.
Ctrl+Home Places the insertion point before the first character in the
script.
End Places the insertion point after the last character in the line.
Ctrl+Home Places the insertion point before the first character in the
script.
Ctrl+End Places the insertion point after the last character in the script.
Editing Shortcuts
Key(s) Function
Ctrl+Y Deletes the entire line containing the insertion point without
placing it on the Clipboard.
Ctrl+C Copies the selected text, without removing it from the script,
and places it on the Clipboard.
Ctrl+X Removes the selected text from the script and places it on the
Clipboard.
Shift + any navigating Selects the text between the initial location of the insertion
shortcut point and the point to which the keyboard shortcut would
normally move the insertion point. (For example, pressing
Shift + Ctrl + Left arrow selects the word to the left of the
insertion point; pressing Shift+Ctrl+Home selects all the text
from the location of the insertion point to the start of your
script.)
Debugging Shortcuts
Key(s) Function
Shift+F9 Displays the Add Watch dialog box, in which you can specify
the name of a BasicScript variable. Script Editor then displays
the value of that variable, if any, in the watch pane of its
application window.
Del Removes the selected watch variable from the watch pane.
Enter or F2 Displays the Modify Variable dialog box for the selected
watch variable, which enables you to modify the value of that
variable.
Step Action
1 When you pass the pointer over an area of Script Editor's application window on which you
can obtain help, a question mark appears beside the mouse pointer to indicate that the Help
pointer is active. To activate the Help pointer, press Shift+F1.
Note: You can use the Help pointer to obtain help on all toolbar tools and menu commands,
including those that are currently disabled.
2 Place the Help pointer on the item for which you want help and click the mouse button. Script
Editor's Help system displays information for the item on which you clicked.
Step Action
1 Select the BasicScript term on which you want help or place the insertion
point anywhere in the term or,
Select the watch variable or menu command on which you want help
(including commands that are currently disabled), or
Script Editor's Help system displays information on the BasicScript term, watch variable,
menu command, or dialog box.
Step Action
1 From the Help menu, choose the Search for Help on command.
The topic you selected is displayed in the second scrollable list, together with
closely related Help topics, if any.
4 Click the Go To button or press Enter.
Step Action
1 From the Help menu, choose Contents.
The Help system either displays information on the selected topic or presents a list of
more specific subtopics from which you can choose to obtain the desired information.
Step Action
1 Use the scroll bars at the right and bottom of the display to scroll the target
area of the script into view if it is not already visible.
2 Place the mouse pointer where you want to position the insertion point.
3 Click the left mouse button.
ATTENTION
When you scroll the display with the mouse, the insertion point remains in its
original position until you reposition it with a mouse click. If you attempt to
perform an editing operation when the insertion point is not in view, Script
Editor automatically scrolls the insertion point into view before performing the
operation.
Step Action
1 Press F4.
2 Enter the number of the line in your script to which you want to move the
insertion point.
Step Action
3 Click the OK button or press Enter.
The insertion point is positioned at the start of the line you specified. If that
line was not already displayed, Script Editor scrolls it into view.
ATTENTION
The insertion point cannot be moved so far below the end of a script as to
scroll the script entirely off the display. When the last line of your script
becomes the first line on your screen, the script will stop scrolling, and you
will be unable to move the insertion point below the bottom of that screen.
Inserting Text
In Script Editor, inserting text and other characters such as tabs and line breaks works
about the same way as it does in a word-processing program: you position the insertion
point at the desired location in the script and start typing.
However, as noted in the preceding subsection, Script Editor lets you position the
insertion point in "empty spaces," which means that you can also insert text into empty
spaces—a feature that comes in handy when you want to insert a comment in the space
beyond the end of a line in your script. (Adding comments to your script is discussed
later in this section.) When you insert characters beyond the end of a line, the space
between the insertion point and the last character on the line is backfilled with tab
characters.
Another way in which Script Editor differs from word-processing programs is that in
Script Editor, text does not wrap. If you keep entering text on a given line, eventually you
will reach a point at which you can enter no more text on that line. Therefore, you control
the line breaks by pressing Enter when you want to insert a new line in your script. The
effect of pressing Enter depends on where the insertion point is located at the time:
• If you press Enter with the insertion point at or beyond the end of a line, a new line
is inserted after the current line.
• If you press Enter with the insertion point at the start of a line, a new line is inserted
before the current line.
• If you press Enter with the insertion point within a line, the current line is broken
into two lines at that location.
If you press Tab, a tab character is inserted at the location of the insertion point, which
causes text after the tab to be moved to the next tab position. If you insert new text within
a tab's expanded space, the text that originally appeared on that line is moved to the next
tab position each time the new text that you are entering reaches the start of another tab
position.
When you enter certain types of text in Script Editor, the text automatically appears in a
distinctive color. The default colors, which you can change, are as follows:
• When you type keywords, they appear in blue.
• When you type identifier text, it appears in black.
• When you type comments (beginning with either an apostrophe or "REM"), they
appear in green.
Selecting Text
You can use either the mouse or the keyboard to select text and other characters in your
script. Regardless of which method you use, you should be aware that in Script Editor,
you can select either a portion of one line or a series of whole lines, but you cannot select
a portion of one line plus one or more whole lines. When you are selecting multiple lines
and start or end your selection partway through a line, Script Editor automatically
extends the selection to include the entire starting and ending lines.
Step Action
1 Place the mouse pointer where you want your selection to begin.
2 While pressing the left mouse button, drag the mouse until you reach the end
of your selection, and release the mouse button or
While pressing Shift, place the mouse pointer where you want your selection
to end and click the left mouse button.
Another way to select one or more whole lines with the mouse is to start by placing the
mouse pointer in the left margin beside the first line you want to select. The pointer
becomes a reverse arrow, which points toward the line of text. Click the left mouse
button to select a single line; press the left mouse button and drag up or down to select
multiple lines.
Step Action
1 Place the insertion point where you want your selection to begin.
2 While pressing Shift, use one of the navigating keyboard shortcuts to extend
the selection to the desired ending point.
ATTENTION
When you intend to select an entire single line of text in your script, it is
important to remember to extend your selection far enough to include the
hidden end-of-line character, which is the character that inserts a new line in
your script.
Step Action
1 Place the insertion point at the beginning of the line you want to select.
2 Press Shift + Down arrow.
Once you have selected text within your script, you can perform a variety of other editing
operations on it, including deleting the text, placing it on the Clipboard (either by cutting
the text or copying it), and pasting it.
Deleting Text
When you delete material, it is removed from your script without being placed on the
Clipboard.
To delete text
Here's how to remove one or more characters, selected text, or entire lines from your
script.
• To remove a single character to the left of the insertion point, press BkSp once; to
remove a single character to the right of the insertion point, press Del once. To
remove multiple characters, hold down BkSp or Del.
-Or-
• To remove text that you have selected, press BkSp or Del.
-Or-
• To remove an entire line, place the insertion point in that line and press Ctrl+Y.
Step Action
1 Place the insertion point after the last character on the current line.
2 Press Del once to delete the hidden end-of-line character.
ATTENTION
If any spaces were entered at the end of the current line, you may have to
press Del one or more additional times to remove these hidden characters
first before you can delete the end-of-line character.
Pressing BkSp with the insertion point at the start of a line has no effect—that
is, it will not combine the current line with the preceding line.
To cut a selection
• Press Ctrl+X.
The selection is removed from your script and placed on the Clipboard.
To copy a selection
Here's how to place on the Clipboard text that you have copied from your script.
• Press Ctrl+C.
The selection remains in your script, and a copy of it is placed on the Clipboard.
Pasting Text
Once you have cut or copied material to the Clipboard, here’s how to paste it into your
script at another location.
Step Action
1 Position the insertion point where you want to place the contents of the
Clipboard.
2 Press Ctrl+V.
The contents of the Clipboard appear at the location of the insertion point.
If you wish to delete a block of text and insert the contents of the Clipboard in its place,
you can combine the two operations by first selecting the text you want to remove and
then pressing Ctrl+V to replace it with the contents of the Clipboard.
Step Action
1 Type an apostrophe ( ' ) at the start of the line.
2 Type your comment following the apostrophe.
When your script is run, the presence of the apostrophe at the start of the line will cause
the entire line to be ignored.
Here's how to designate the last part of a line as a comment.
Step Action
1 Position the insertion point in the empty space beyond the end of the line of
code.
2 Type an apostrophe ( ' ).
3 Type your comment following the apostrophe.
ATTENTION
When your script is run, the code on the first portion of the line will be
executed, but the presence of the apostrophe at the start of the comment will
cause the remainder of the line to be ignored.
Although you can place a comment at the end of a line containing executable code, you
cannot place executable code at the end of a line containing a comment because the
presence of the apostrophe at the start of the comment will cause the balance of the line
(including the code) to be ignored.
Step Action
1 Type the BasicScript statement on multiple lines, exactly the way you want it
to appear.
2 Place the insertion point at the end of the first line in the series.
4 Type an underscore ( _ ).
NOTE: the underscore is the line continuation character, which indicates that
the BasicScript statement continues on the following line.
ATTENTION
When you run your script, the code on this series of lines will be executed as
a single BasicScript statement, just as if you had typed the entire statement
on the same line.
Step Action
1 Move the insertion point to where you want to start your search. (To start at
the beginning of your script, press Ctrl+Home.)
2 Press Ctrl+F. Script Editor displays the Find dialog box
3 In the Find What field, specify the text you want to find.
4 Select the Match Case check box if you want the search to be case-sensitive.
Otherwise, the search will be case-insensitive.
5 Click the Find Next button or press Enter.
The Find dialog box remains displayed, and Script Editor either highlights the
first instance of the specified text or indicates that it cannot be found.
6 If the specified text has been found, repeat step 5 to search for the next
instance of it.
ATTENTION
If the Find dialog box blocks your view of an instance of the specified text,
you can move the dialog box out of your way and continue with your search.
You can also click the Cancel button, which removes the Find dialog box
while maintaining the established search criteria, and then press F3 to find
successive occurrences of the specified text. (If you press F3 when you have
not previously specified text for which you want to search, Script Editor
displays the Find dialog box so you can specify the desired text.).
Step Action
1 Move the insertion point to where you want to start the replacement
operation. (To start at the beginning of your script, press Ctrl+Home.)
2 Choose the Replace command from the Search menu.
3 In the Find What field, specify the text you want to replace.
4 In the Replace With field, specify the replacement text.
5 Select the Match Case check box if you want the replacement operation to be
case-sensitive. Otherwise, it will be case-insensitive.
6 To replace all instances of the specified text, click the Replace All button.
Script Editor either replaces the specified text throughout your script or
indicates the number of occurrences it has changed, or it indicates that the
specified text cannot be found.
7 To replace selected instances of the specified text, click the Find Next button.
Script Editor either highlights the first instance of the specified text or
indicates that it cannot be found.
8 If the specified text has been found, either click the Replace button to replace
that instance of it or click the Find Next button to highlight the next instance (if
any).
Each time you click the Replace button; Script Editor replaces that instance of the
specified text and automatically highlights the next instance.
Step Action
1 From the Run menu, choose the Syntax Check command.
Script Editor either indicates that no errors have been found or displays an
error message that specifies the first line in your script where an error has
been found and briefly describes the nature of that error.
2 Click the OK button or press Enter.
If Script Editor has found a syntax error, the line containing the error is
highlighted on your display.
3 Correct the syntax error.
4 Repeat steps 1–3 until you have found and corrected all syntax errors.
Step Action
1 Place the insertion point where you want the new dialog box template to
appear in your script.
2 From the Edit menu, choose the Insert New Dialog command.
Script Editor automatically places the new dialog box template generated by
Dialog Editor in your script at the location of the insertion point.
Step Action
1 Select the BasicScript code for the entire dialog box template.
2 From the Edit menu, choose the Edit Dialog command.
Refer to “Recording Scripts” for a detailed discussion of how to use Dialog Editor to
create and edit dialog box templates.
ATTENTION
During script execution, Script Editor's application window is available only in
a limited manner. Some of the menu commands may be disabled, and the
toolbar tools may be inoperative.
ATTENTION
The instruction pointer designates the line of code that will be executed next if
you resume running your script.
ATTENTION
Many of the functions of Script Editor's application window may be
unavailable while you are running a script. If you want to stop your script but
find that the toolbar is currently inoperative, press Ctrl+Break to pause your
script, then click the End tool.
TIP
When you initiate execution of your script with any of these methods, the
script will first be compiled, if necessary. Therefore, there may be a slight
pause before execution actually begins. If your script contains any compile
errors, it will not be executed. To debug your script, first correct any compile
errors, and then initiate execution again.
Step Action
1 Click the Single Step or Procedure Step tool on the toolbar or
Script Editor places the instruction pointer on the Sub Main line of your script.
2 To continue tracing the execution of your script line by line, repeat step 1.
Each time you repeat step 1, Script Editor executes the line containing the
instruction pointer and moves the instruction pointer to the next line to be
executed.
3 When you finish tracing the execution of your script, either click the Start tool
on the toolbar (or press F5) to run the balance of the script at full speed or
click the End tool to halt execution of the script.
Step Action
1 Place the insertion point in the line where you want to resume stepping
through the script.
2 From the Debug menu, choose the Set Next Statement command. The
instruction pointer moves to the line you selected, and you can resume
stepping through your script from there.
TIP
You can only use the Set Next Statement command to move the instruction
pointer within the same subroutine. If you place the insertion point on a line
that is not in the same subroutine, the Set Next Statement command will be
disabled in the Debug menu.
Setting Breakpoints
You can set breakpoints to begin the debugging process partway through your script, to
continue debugging at a line outside the current subroutine, and to debug only selected
portions of your script.
Valid breakpoints can only be set on lines in your script that contain code, including lines
in functions and subroutines. Although you can set a breakpoint anywhere within a script
prior to execution, when you compile and run the script, invalid breakpoints (that is,
breakpoints on lines that don't contain code) are automatically removed. While you are
debugging your script, Script Editor will beep if you try to set a breakpoint on a line that
does not contain code.
Or
Press F9.
If you want to continue debugging at another line in your script, you can use the Set Next
Statement command in the Debug menu to move the instruction pointer to the desired
line—provided the line is within the same subroutine.
Step Action
1 Place a breakpoint at the start of each portion of your script that you want to
debug.
The script executes at full speed until it reaches the line containing the first
breakpoint and then pauses with the instruction pointer on that line.
3 Step through as much of the code as you need to.
4 To resume running your script, click the Start tool on the toolbar or press F5.
The script executes at full speed until it reaches the line containing the
second breakpoint and then pauses with the instruction pointer on that line.
5 Repeat steps 3 and 4 until you have finished debugging the selected portions
of your script.
Press F9.
Press Shift+F9
If the insertion point is in the edit pane, press F6 to highlight the most recently selected
variable on the watch list and then use the arrow keys to move the selection highlight to
the desired variable.
ATTENTION
Pressing F6 again returns the insertion point to its previous position in the
edit pane.
Or
When changing the value of a variable, Script Editor will, if necessary, convert the value
you entered to match the type of the variable. For example, if you change the value of an
Integer variable to 1.7, Script Editor converts this value from a floating-point number to
an Integer is performed, assigning the value 2 to the variable.
When modifying a Variant variable, Script Editor needs to determine both the type and
value of the data. Script Editor uses the following logic in performing this assignment (in
this order):
number The Variant variable is assigned the value of number. The type
of the variant is the smallest data type that fully represents that
number.
You can force the data type of the variable by using a type-
declaration letter following number, such as %, #, &, !, or @.
date The Variant variable is assigned the value of the new date
(VarType 7).
ATTENTION
Script Editor will not assign a new value if it cannot be converted to the same
type as the specified variable.
Exit and Esc Compiles your script and returns you to the host
Return application.
Edit Menu
Cut Ctrl+X Removes the selected text from the script and places it
on the Clipboard.
Copy Ctrl+C Copies the selected text, without removing it from the
script, and places it on the Clipboard.
Delete Del or BkSp Removes the selected text from the script without
placing it on the Clipboard.
Insert New Invokes the Summit Dialog Editor, which you can use to
Dialog... create a new dialog box for insertion into your script
Edit Dialog... Invokes the Summit Dialog Editor, which you can use to
edit the selected dialog box template. (This command is
only enabled if a dialog box template is currently
selected.)
Find... Ctrl+F Displays the Find dialog box, which allows you to specify
text for which you want to search.
Goto Line... Ctrl+G Presents the Goto Line dialog box, which allows you to
move the insertion point to the start of a specified line
number in your script.
TIP
The Insert New Dialog and Edit Dialog commands only appear in the Edit
menu if you are running the BasicScript 2.2 on a platform that supports Dialog
Editor
Run Menu
Debug Menu
Add Watch... Shift+F9 Displays the Add Watch dialog box, in which you can specify
the name of a BasicScript variable. That variable, together with
its value (if any), is then displayed in the watch pane of Script
Editor's application window.
Delete Watch Del Deletes a selected variable from the watch variable list.
Modify... Enter or F2 Displays the Modify Variable dialog box for a selected variable,
which enables you to modify the value of that variable.
Single Step F8 Steps through the script code line by line, tracing into called
procedures
Procedure Shift+F8 Steps through the script code line by line without tracing into
Step called procedures.
Clear All Removes all breakpoints previously set with the Toggle
Breakpoints Breakpoint command.
Set Next Enables you to place the instruction pointer on another line
Statement within the current procedure and resume script execution from
that point.
Help Menu
Contents Displays a list of major topics on which you can obtain help
Search for Displays the Search dialog box, which allows you to search for
Help on… Help topics containing specific keyword.
2.2 Contents
• Overview
• Using the Summit Dialog Editor
• Creating a Custom Dialog Box
• Editing a Custom Dialog Box
• Editing an Existing Dialog Box
• Testing an Edited Dialog Box
• Incorporating a Dialog Box Template into Your Script
• Exiting from Dialog Editor
• Using a Custom Dialog Box in Your Script
• Using a Dynamic Dialog Box in Your Script
• Menu Reference
2.3 Overview
Sometimes your script will need to obtain information from the user. In many cases, you
can obtain this information by using one of BasicScript's predefined dialog boxes in your
script. When you must go beyond the information-gathering capabilities provided by
predefined dialog boxes, you can use Dialog Editor to create a custom dialog box for use
in your script.
Dialog Editor is a tool that allows you to generate a dialog box template in BasicScript
simply by editing an on-screen dialog box layout. You can then incorporate the template
that Dialog Editor generates into your script. The balance of this section provides general
information that you'll need in order to work with Dialog Editor, including:
• Features that Dialog Editor supports
• An introduction to Dialog Editor's application window
• A list of keyboard shortcuts
• How to use the Help system
Then, in the following sections, you'll learn how to use Dialog Editor to create and edit
custom dialog boxes and to edit dialog boxes captured from other applications. You'll
also learn how to test an edited dialog box and incorporate the dialog box template
generated by Dialog Editor into your script. And finally, you'll learn how to exit from
Dialog Editor.
ATTENTION
Dialog boxes created with Dialog Editor normally appear in an 8 point
Helvetica font, both in Dialog Editor's application window and when the
corresponding BasicScript code is run.
Pick Lets you select, move, and resize items and control the
insertion point.
Drop List Box Adds a drop list box to your dialog box.
Key(s) Function
Ctrl+I Displays the Information dialog box for the selected dialog box
or control.
Ctrl+V Inserts the contents of the Clipboard into Dialog Editor. If the
Clipboard contains BasicScript statements describing one or
more controls, then Dialog Editor adds those controls to the
current dialog box. If the Clipboard contains the BasicScript
template for an entire dialog box, then Dialog Editor creates a
new dialog box from the statements in the template.
Key(s) Function
TIP
Group boxes, text controls, and pictures are passive elements in a dialog
box, inasmuch as they are used purely for decorative or informative
purposes. Users cannot act upon these controls, and when they tab through
the dialog box, the focus skips over these controls.
You can obtain a Windows bitmap or metafile from a file or from a specified
library.
To add a control
Here's how to add one or more controls to your dialog box using simple mouse and
keyboard methods.
After the new control has appeared, the mouse pointer becomes an arrow, to indicate that
the Pick tool is active and you can once again select any of the controls in your dialog
box.
To add another control of the same type as the one you just added,
• Press Ctrl+D.
A duplicate copy of the control appears.
To add a different type of control,
• Repeat steps 1 and 2 above.
As you move the mouse pointer over the dialog box after you have chosen a control tool
from the toolbar, the status bar displays the name of the type of control you have selected
and continually updates the position of the mouse pointer in X and Y units. (This
information disappears if you move the mouse pointer over an area of the screen where a
control cannot be placed.) After you click the mouse button to add a control, that control
remains selected, and the status bar displays the control's width and height in dialog units
as well as its name and position, as shown in the preceding illustration, in which the push
button is selected.
ATTENTION
Dialog units represent increments of the font in which Dialog Editor creates
dialog boxes (namely, 8 point Helvetica). Each X unit represents an
increment equal to 1/4 of that font, and each Y unit represents an increment
equal to 1/8 of that font.
To select a control
• With the Pick tool active, place the mouse pointer on the desired control and click
the mouse button.
-Or-
With the Pick tool active, press the Tab key repeatedly until the focus moves to the
desired control.
The control is now surrounded by a thick frame to indicate that it is selected and you can
edit it.
The following lists show the attributes that you can change with the Dialog Box
Information dialog box and the Information dialog boxes for the various controls. In
some cases (specified below), it's mandatory to fill in the fields in which the attributes are
specified—that is, you must either leave the default information in these fields or replace
it with more meaningful information, but you can't leave the fields empty. In other cases,
filling in these fields is optional—that is, you can either leave the default information in
the fields, replace it with more meaningful information, or leave the fields entirely
empty.
TIP
A quick way to determine whether it's mandatory to fill in a particular
Information dialog box field is to see whether the OK button becomes grayed
out when you delete the information in that field. If it does, then you must fill
in that field.
In many cases, you could simply leave the generic-sounding default information in the
Information dialog box fields and worry about replacing it with more meaningful
information after you paste the dialog box template into your script. However, if you take
a few moments to replace the default information with something specific when you first
create your dialog box, not only will you save yourself some work later on but you may
also find that your changes make the BasicScript code produced by Dialog Editor more
readily comprehensible and hence easier to work with.
Attributes That You Can Adjust with the Dialog Box Information Dialog Box
The Dialog Box Information dialog box can be used to check and adjust the following
attributes, which pertain to the dialog box as a whole.
Mandatory/ Attribute
Optional
Mandatory Size: width and height of the dialog box, in dialog units.
Optional Style: options that allow you to determine whether the close box and
title bar are displayed.
Optional Text$: text displayed on the title bar of the dialog box.
Mandatory Name: name by which you refer to this dialog box template in your
BasicScript code.
Mandatory/ Attribute
Optional
Optional Picture Library: picture library from which one or more pictures in
the dialog box are obtained.
Attributes That You Can Adjust with the Information Dialog Box for a Control
The Information dialog box for a control can be used to check and adjust the following
attributes. The second column of the list indicates the control(s) to which each attribute
pertains.
Mandatory Check box, text box, list .Identifier: name by which you refer to a
box, combo box, drop list control in your BasicScript code; also
box, and help button contains the result of the control after the
dialog box has been processed.
Mandatory List box, combo box, and Array$: name of an array variable in your
drop list box BasicScript code
Step Action
1 With the Pick tool active, place the mouse pointer on an empty area of the
dialog box or on a control.
2 Depress the mouse button and drag the dialog box or control to the desired
location.
ATTENTION
The increments by which you can move a control with the mouse are
governed by the grid setting. For example, if the grid's X setting is 4 and its Y
setting is 6, you'll be able to move the control horizontally only in increments
of 4 X units and vertically only in increments of 6 Y units. This feature is
handy if you're trying to align controls in your dialog box. If you want to move
controls in smaller or larger increments, press Ctrl+G to display the Grid
dialog box and adjust the X and Y settings
Step Action
1 Select the dialog box or control that you want to move
2 Press an arrow key once to move the item by 1 X or Y unit in the desired
direction.
Or
Depress an arrow key to "nudge" the item steadily along in the desired
direction.
ATTENTION
When you reposition an item with the arrow keys, a faint, partial afterimage of
the item may remain visible in the item's original position. These afterimages
are rare and will disappear once you test your dialog box
To reposition a dialog box with the Dialog Box Information dialog box
Step Action
1 Display the Dialog Box Information dialog box.
2 Change the X and Y coordinates in the Position group box.
Or
If you specified X and Y coordinates, the dialog box moves to that position. If you left
the X coordinate blank, the dialog box will be centered horizontally relative to the parent
window of the dialog box when the dialog box is run. If you left the Y coordinate blank,
the dialog box will be centered vertically relative to the parent window of the dialog box
when the dialog box is run.
Step Action
1 Display the Information dialog box for the control that you want to move.
2 Change the X and Y coordinates in the Position group box.
3 Click the OK button or press Enter.
TIP
When you move a dialog box or control with the arrow keys or with the
Information dialog box, the item's movement is not restricted to the
increments specified in the grid setting.
When you attempt to test a dialog box containing hidden controls (i.e.,
controls positioned entirely outside the current borders of your dialog box),
Dialog Editor displays a message advising you that there are controls outside
the dialog box's borders and asks whether you wish to proceed with the test.
If you proceed, the hidden controls will be disabled for testing purposes.
(Testing dialog boxes is discussed later in the chapter.).
Step Action
1 With the Pick tool active, select the dialog box or control that you want to
resize.
2 Place the mouse pointer over a border or corner of the item.
3 Depress the mouse button and drag the border or corner until the item
reaches the desired size.
Step Action
1 Display the Information dialog box for the dialog box or control that you want
to resize.
2 Change the Width and Height settings in the Size group box.
3 Click the OK button or press Enter.
Step Action
1 With the Pick tool active, select the option button, text control, push button,
check box, or text box that you want to resize
2 Press F5.
The borders of the control will expand or contract to fit the text displayed on it
ATTENTION
Windows metafiles always expand or contract proportionally to fit within the
picture control or picture button control containing them. In contrast, Windows
bitmaps are of a fixed size. If you place a bitmap in a control that is smaller
than the bitmap, the bitmap is clipped off on the right and bottom. If you place
a bitmap in a control that is larger than the bitmap, the bitmap is centered
within the borders of the control. Picture controls and picture button controls
must be resized manually.
Although OK and Cancel buttons also have labels, you cannot change them. The
remaining controls (text boxes, list boxes, combo boxes, drop list boxes, pictures, and
picture buttons) don't have their own labels, but you can position a text control above or
beside these controls to serve as a de facto label for them
ATTENTION
Accelerator key assignments must be unique within a particular dialog box. If
you attempt to assign the same accelerator key to more than one control,
Dialog Editor displays a reminder that letter has already been assigned.
If, for example, you have a push button whose label reads Apply, you can designate A as
the accelerator key by displaying the Push Button Information dialog box and typing
&Apply in the Text$ field. When you press Enter, the button label looks like the
following illustration, and users will be able to choose the button by typing Alt+A.
As another example, let's say you have a list box that is immediately preceded in the
dialog box template by a text control whose label reads 1994 Project Files. By using the
method described above, you can designate F as the accelerator key. When you click OK
or press Enter, the text control label looks like the following illustration, and users will be
able to move the insertion point to the currently selected item in the list box by typing
Alt+F.
TIP
In order for such a de facto accelerator key to work properly, the text control
or group box label to which you assign the accelerator key must be
associated with the control(s) to which you want to provide user access—that
is, in the dialog box template, the description of the text control or group box
must immediately precede the description of the control(s) that you want
associated with it. The simplest way to establish such an association is to
create the text control or group box first, followed immediately by the
associated control(s).
Step Action
1 Create a C file containing the minimal code required to establish a DLL. The
following code can be used:
#include <windows.h>
W ORD wDataSeg,
WORD wHeapSz,
LPSTR lpCmdLine) {
Unlock Data(0);
return 1;}
Step Action
2 Use the following code to create a DEF file for your picture library:
LIBRARY
EXETYPE WINDOWS
HEAPSIZE 1024
3 Create a resource file containing your images. The following example shows
a resource file using a bitmap called sample.bmp and a metafile called
usa.wmf.
Step Action
1 Make a copy of the picture library you want to modify.
2 Modify the copy by adding images using a resource editor such as Borland's
Resource Workshop or Microsoft's App Studio.
TIP
When you use a resource editor, you need to create a new resource type for
metafiles (with the value 256).
Step Action
1 Select the control you want to delete.
2 Press Del.
To paste one or more controls from an existing dialog box into Dialog Editor
If you want to modify the BasicScript statements in your script that correspond to one or
more dialog box controls, here's how to select the statements and paste them into Dialog
Editor for editing.
ATTENTION
When you paste a dialog box template into Dialog Editor, the tabbing order of
the controls is determined by the order in which the controls are described in
the template. When you paste one or more controls into Dialog Editor, they
will come last in the tabbing order, following the controls that are already
present in the current dialog box.
If there are any errors in the BasicScript statements that describe the dialog
box or controls, the Dialog Translation Errors dialog box will appear when you
attempt to paste these statements into Dialog Editor. This dialog box shows
the lines of code containing the errors and provides a brief description of the
nature of each error.
4 Select the dialog box you want to Dialog Editor now displays the
capture, and then click OK. standard Windows controls from the
target dialog box.
ATTENTION
Dialog Editor only supports standard Windows controls and standard
Windows dialog boxes. Therefore, if the target dialog box contains both
standard Windows controls and custom controls, only the standard Windows
controls will appear in Dialog Editor's application window. If the target dialog
box is not a standard Windows dialog box, you will be unable to capture the
dialog box or any of its controls
ATTENTION
If there are any errors in the BasicScript statements that describe the dialog
box, the Dialog Translation Errors dialog box will appear when you attempt to
load the file into Dialog Editor. This dialog box shows the lines of code
containing the errors and provides a brief description of the nature of each
error.
• Are the close box and title bar displayed (or hidden) as you intended?
• Are the control labels and dialog box title spelled and capitalized correctly?
• Do all the controls fit within the borders of the dialog box?
• Could you improve the design of the dialog box by adding one or more group boxes
to set off groups of related controls?
• Could you clarify the purpose of any unlabeled control (such as a text box, list box,
combo box, drop list box, picture, or picture button) by adding a text control to serve
as a de facto label for it?
• Have you made all the necessary accelerator key assignments?
After you've fixed any elementary problems, you're ready to run your dialog box so you
can check for problems that don't become apparent until a dialog box is activated.
Testing your dialog box is an iterative process that involves running the dialog box to see
how well it works, identifying problems, stopping the test and fixing those problems,
then running the dialog box again to make sure the problems are fixed and to identify any
additional problems, and so forth—until the dialog box functions the way you intend.
Step Action
1 Click the Run tool on the toolbar
Or
Press F5
The dialog box becomes operational, and you can check how it functions.
2 To stop the test, click the Run tool, press F5, or double-click the dialog box's
close box (if it has one).
3 Make any necessary adjustments to the dialog box.
4 Repeat steps 1–3 as many times as you need in order to get the dialog box
working properly.
When testing a dialog box, you can check for operational problems such as the following:
• Tabbing order: When you press the Tab key, does the focus move through the
controls in a logical order? (Remember, the focus skips over items that users cannot
act upon, including group boxes, text controls, and pictures.)
When you paste controls into your dialog box, Dialog Editor places their descriptions at
the end of your dialog box template, in the order in which you paste them in. Therefore,
you can use a simple cut-and-paste technique to adjust the tabbing order. First, click the
Run tool to end the test and then, proceeding in the order in which you want the controls
to receive the focus, select each control, cut it from the dialog box (by pressing Ctrl+X),
and immediately paste it back in again (by pressing Ctrl+V). The controls will now
appear in the desired order in your template and will receive the tabbing focus in that
order.
• Option button grouping: Are the option buttons grouped correctly? Does selecting
an unselected button in a group automatically deselect the previously selected button
in that group?
To merge two groups of option buttons into a single group, click the Run tool to end the
test and then use the Option Button Information dialog box to assign the same .Option
Group name for all the buttons that you want included in that group.
• Text box functioning: Can you enter only a single line of nonwrapping text, or can
you enter multiple lines of wrapping text?
If the text box doesn't behave the way you intended, click the Run tool to end the test;
then display the Text Box Information dialog box and select or clear the Multiline check
box.
• Accelerator keys: If you have assigned an accelerator key to a text control or group
box in order to provide user access to a text box, list box, combo box, drop list box,
or group box, do the accelerator keys work properly? That is, if you press Alt + the
designated accelerator key, does the insertion point move into the text box or group
box or to the currently selected item in the list box, combo box, or drop list box?
If the accelerator key doesn't work properly, it means that the text box, list box, combo
box, drop list box, or group box is not associated with the text control or group box to
which you assigned the accelerator key—that is, in your dialog box template, the
description of the text control or group box does not immediately precede the description
of the control(s) that should be associated with it. As with tabbing-order problems
(discussed above), you can fix this problem by using a simple cut-and-paste technique to
adjust the order of the control descriptions in your template. First, click the Run tool to
end the test; then cut the text control or group box from the dialog box and immediately
paste it back in again; and finally, do the same with each of the controls that should be
associated with the text control or group box. The controls will now appear in the desired
order in your template, and the accelerator keys will work properly.
Step Action
1 Create a dialog record by using a Dim statement.
2 Put information into the dialog box by assigning values to its controls.
3 Display the dialog box by using either the Dialog() function or the Dialog
statement.
4 Retrieve values from the dialog box after the user closes it.
As you can see, this custom dialog box isn't very useful. For one thing, the user doesn't
see any items in the list box along the left side of the dialog box. To put information into
this dialog box, you assign values to its controls by modifying the statements in your
script that are responsible for displaying those controls to the user. The following table
lists the dialog box controls to which you can assign values and the types of information
you can control.
In the following subsections, you'll learn how to define and fill an array, set the default
text in a text box, and set the initial focus and tab order for the controls in your custom
dialog box.
Value Returned If
Sample
In the following sample script, a version of which can be found on your disk under the
name dialog2.ebs, several of the techniques described earlier in this section have been
used.
In this script, the array named ListBox1 is filled with three elements ("Apples",
"Oranges", and "Pears"). The default value of TextBox1 is set to 12. A variable named
response is used to store information about how the custom dialog box was closed. An
identifier named ListBox1 is used to determine whether the user chose "Apples",
"Oranges", or "Pears" in the list box named ListBox$. Finally, a Select Case...End Select
statement is used to display a message box appropriate to the manner in which the user
dismissed the dialog box.
Sub Main()
Dim ListBox1$(2) ’Initialize list box array.
Dim response%
ListBox1$(0) = "Apples"
ListBox1$(1) = "Oranges"
ListBox1$(2) = "Pears"
Begin Dialog UserDialog ,,163,94,"Grocery Order"
Text 13,6,32,8,"&Quantity:",.Text1 'First
control
'in the
'template gets
’focus.
TextBox 48,4,28,12,.TextBox1
ListBox 12,28,68,32,ListBox1$,.ListBox1
OKButton 112,8,40,14
CancelButton 112,28,40,14
End Dialog
Dim b As UserDialog 'Create the dialog record.
b.TextBox1 = "12" 'Set default value of the
'text box to 1 dozen.
response = Dialog(b) 'Display the dialog box.
Select Case response%
Case -1
Fruit$ = ListBox1$(b.ListBox1)
MsgBox "Thank you for ordering " + _
b.TextBox1 + " " + Fruit$ + "."
Case 0
MsgBox "Your order has been canceled."
End Select
End Sub
Action Description
1 This action is sent immediately before the dialog box is shown for the first time.
3 This action is sent when the content of a text box or combo box has been
changed and that control loses focus.
New Ctrl+N Creates a new dialog box. Dialog Editor prompts you
before discarding any changes you have made to your
current dialog box.
Open... Ctrl+O Displays the Open Dialog File dialog box, which you can
use to open an existing dialog box template. Dialog Editor
prompts you before discarding any changes you have
made to your current dialog box.
Save Ctrl+S If you have already created a file for the current dialog
box template, saves the template to that file.
If you have not yet created a file for the current dialog box
template, displays the Save Dialog File dialog box, which
you can use to specify the file to which you want to save
the current template.
Save As... Displays the Save Dialog File dialog box, which you can
use to save the current dialog box template in a file under
a new name.
Test Dialog F5 Toggles between the run mode (in which the dialog box
"comes alive" for testing purposes) and the edit mode (in
which you can make changes to the dialog box).
Exit & Return Alt+F4 Closes Dialog Editor and returns you to the host
application. Dialog Editor prompts you before discarding
any changes you have made to your current dialog box.
Edit Menu
Paste Ctrl+V Inserts the contents of the Clipboard into Dialog Editor.
Size to Text F2 Adjusts the borders of certain controls to fit the text
displayed on them.
Info... Ctrl+I Displays the Information dialog box for the selected
dialog box or control. You can use this dialog box to
check and adjust various attributes of controls and
dialog boxes.
Grid... Ctrl+G Displays the Grid dialog box, which you can use to
display or turn off the grid and adjust the grid's spacing.
Controls Menu
Command
Help button Adds a Help button to your dialog box. A Help button is a
special type of push, or command, button.
Check box Adds a check box to your dialog box. Users can check or
clear a check box to indicate their preference regarding
the alternative specified on the check box label.
Group box Adds a group box to your dialog box. A group box is a
rectangular design element used to enclose a group of
related controls. You can use the optional group box label
to display a title for the controls in the box.
Command
Text box Adds a text box to your dialog box. A text box is a field
into which users can enter text (potentially, as much as
32K). By default, this field holds a single line of
nonwrapping text. If you choose the Multiline setting in
the Text Box Information dialog box, this field will hold
multiple lines of wrapping text.
List box Adds a list box to your dialog box. A list box is a
displayed, scrollable list from which users can select one
item. The currently selected item is highlighted on the list.
Combo box Adds a combo box to your dialog box. A combo box
consists of a text field with a displayed, scrollable list
beneath it. Users can either select an item from the list or
enter the name of the desired item in the text field. The
currently selected item is displayed in the text field. If the
item was selected from the scrolling list, it is highlighted
there as well.
Drop list box Adds a drop list box to your dialog box. A drop list box
consists of a field that displays the currently selected
item, followed by a downward-pointing arrow, which users
can click to temporarily display a scrolling list of items.
Once they select an item from the list, the list disappears
and the newly selected item is displayed in the field.
Help Menu
Search for Displays a dialog box that allows users to search for Help
Help On... topics containing specific keywords.
About Dialog Displays the About Dialog Editor dialog box, which
Editor... indicates application name, version number, copyright
statement, and icon, as well as additional information
such as amount of available memory and disk space.
3.2 Contents
• Script Recorder Basics
• Using Script Recorder
• Recording a Script
• Actions Recorded
• Examining and Adjusting Your Script's BasicScript Code
BasicScript statements it outputs as a result. The chapter ends with some suggestions for
adjustments you might want to make to the BasicScript code generated by Script
Recorder.
• Record button: When you first invoke Script Recorder, you won't need to click the
Record button because it will already be in a "pushed," or disabled, state to indicate
that the Recorder is now recording. If you pause the Recorder, clicking the Record
button will resume your recording session.
• Pause button: If you need to take a break in your recording session, clicking the
Pause button will suspend recording. Script Recorder won't record any actions you
perform while the Pause button is pushed.
• End button: Clicking the End button will stop Script Recorder and end your
recording session.
Script Recorder doesn't record anything you do to its control panel, so you can stop, start,
or suspend recording as often as you wish and move the panel to different areas of your
screen as you proceed with your recording session.
To record a script
Statements
AppActivat W inActivat
Statements
VLine HLin e
VPage HPag e
VScroll HScroll
Statements
QueMouseDn QueMouseUp
Statements
QueKeys DoKeys
Statements
AppMaximize W inMaximize
AppMove W inMove
AppSize W inSize
AppRestore W inRestore
Statement
Menu
Statements
ActivateControl SetCheckB ox
SelectButton SetOption
SelectListBoxItem