Customizing AutoScript

There are four ways to customize AutoScript:

Creating shortcut keys

AutoScript is easier to use if you create shortcuts for the menu items that you use frequently. For example, the Edit>Activate AutoScript menu item uses F8 as a shortcut key by default, but you can select a different shortcut key or key combination for this item.

StepsTo modify or create shortcut keys for using AutoScript:

  1. Select Tools>Keyboard Shortcuts from the menu bar and expand the Edit menu in the Keyboard Shortcuts dialog box.

  2. If you want to select a default key for activating AutoScript, scroll down and select Activate AutoScript and type a key sequence, such as Ctrl+Space.

  3. Expand the Go To menu, select Next Marker, and type a key sequence, such as Ctrl+M.

    After you click OK, the shortcuts display in the Edit menu.

AutoScript display customizations

You can change what gets displayed when you activate AutoScript. You make these changes in the AutoScript page of the Options dialog box that you open from a painter’s Design>Options menu.

Figure 6-3: The AutoScript page of the Options dialog box

Shown is the Auto Script page of the Options dialog box. It allows you to set preferences for automated script completion suggestions. The page is divided into four zones entitled Partial Name Resolution, After a Dot, When No Context, and Options. In the snapshot, only the check boxes for Statement Templates, Activate Only After a Dot, and Automatic Pop up are not selected. Selected check boxes are labeled Arguments, Local Variables, Properties, Instance Variables, Shared Variables, Global Variables, and Methods. Automated script suggestions will be provided for these selected items. After a dot, automated script suggestions will be provided for properties, instance variables, and methods. When no context is available, automated script suggestions will be provided for arguments, local variables, instance variables, properties, and methods.

You can select different items to include in these different contexts:

Specifying what displays in the AutoScript list

Table 6-3 shows what is included in an AutoScript list or pasted into a Script view when you make particular selections on the AutoScript page of the Options dialog box.

Table 6-3: Setting options for AutoScript in the Options dialog box

Check box

Displays

Arguments

Arguments for the current function or event.

Local Variables

Variables defined in the current script.

Instance Variables

Variables defined for and associated with an instance of the current object or, after a dot, variables associated with the object preceding the dot.

Shared Variables

Variables defined for the current object and associated with all instances of it.

Global Variables

Variables defined for the current application.

Properties

Properties for the current object or, after a dot, properties for the object preceding the dot. Includes controls on the current window.

Methods

Functions and events for the current object or, after a dot, functions and events for the object preceding the dot.

Statement Templates

PowerScript statement templates for each type of IF, FOR, CHOOSE CASE, TRY, or DO statement with comments indicating what code should be inserted. This option is off by default.

Turning options off reduces the length of the list that displays when you invoke AutoScript. This makes it faster and easier to paste a completion or insert code into the script.

Using automatic pop-up

Most of the time you are likely to use a shortcut key to invoke AutoScript, but you can also have AutoScript pop up a list or paste a selection automatically whenever you pause for several seconds while typing. To do so, check the Automatic Popup box on the AutoScript options page. Automatic pop-up does not operate when the cursor is at the beginning of a line or in white space.

This feature is most useful when you are entering new code. You can customize the options in the Partial Name Resolution Include and After A Dot Include group boxes to reduce the number of times AutoScript pops up.

When you are editing existing code, it is easier to work with automatic pop-up off. AutoScript might pop up a list or paste a template for a function when you do not want it to. Using only the shortcut key to invoke AutoScript gives you complete control.

Using AutoScript only with dot notation

If you want AutoScript to work only when you have typed an identifier followed by a dot, check the Activate Only After a Dot box on the AutoScript options page. The effect of checking this box applies whether or not you have checked Automatic Popup. You might find it most useful when you have checked Automatic Popup, because it provides another way to limit the number of times AutoScript pops up automatically.