PreFab...Player...Documentation...AppleScript...User's Guide...

Chapter 6, Other Terms

Misc. Constants, Modifier Keys, Special Keys, Properties


In addition to verbs, Player defines many "nouns" or constants. (A constant is sort of like a variable that doesn't vary, i.e. whose value remains fixed rather than changing or being changed by a script.)

Player's constants can be divided up into 4 categories:
- Misc. Constants
- Modifier Keys
- Special Keys
- Properties

Each category is described on a separate page for easy reference.



Misc. Constants

Use the screen coordinates constant (new in 1.03) to treat coordinates as an absolute screen position.

To make it easy to set the mouse or typing delay back to the default, Player includes the default mouse delay and default typing delay constants (new in 1.1).

For the new disableUserInput verb, Player 1.5 includes mouse and keyboard constants.

Examples

click location {10, 20, screen coordinates}   -- absolute position
drag from {30, -10} to {31, 28, screen coordinates} }   -- drag window to the upper left corner of the screen

drag through { {40, -10}, {50, 50, screen coordinates} }   -- drag window to an absolute screen position 

set mouse delay to default mouse delay  -- reset (new in 1.1)
set typing delay to default typing delay  -- reset (new in 1.1)

disable user input from keyboard  -- allow mouse activity (new in 1.5)
...
enable user input  -- back to normal

Notes




Modifier Keys

"Modifier keys are those that alter the way other keystrokes are interpreted. These keys sometimes affect the way the mouse-button actions are interpreted as well. They are the Shift, Caps Lock, Option, Command, and Control keys." Macintosh Human Interface Guidelines, p. 278

One or more modifier keys can be held down while performing some other action on the Macintosh. Player adds an optional holding parameter to most verbs.

Examples

type "a" holding command   -- command-A, often for Select All
type "3" holding command & shift   -- screen shot
type right arrow holding option   -- move to end of word (in some apps)
do menu menu item "Print" of menu "File" holding option   -- send a FAX

click location {1,1} holding shift   -- select to the corner of the window

Notes




Special Keys

Many useful keys on the Macintosh keyboard have no real text equivalent. Player lets you specify these keys by name.

List of Supported Keys

standard
space, tab, return, enter, escape, delete
arrows
left arrow, right arrow, up arrow, down arrow
misc.
help, forward delete, home key, end key, page up key, page down key
function
F1 ... F15
keypad
keypad plus, keypad minus, keypad times, keypad divide, keypad equals, keypad decimal, keypad0 ... keypad9

Examples

type delete
type up arrow holding command
type {F1, page up key, down arrow, down arrow}   -- any number of keys
type {"byt", delete, "e"}   -- mix keys and text

Notes




Properties

Player's query verbs provide useful information about an object. Many properties are common to all objects, others are specific to certain kinds. Because these properties pertain to objects in other applications, they are all "read-only" and their values cannot be changed.

List of Properties

Dialog and window items share 5 basic properties: kind, location, height, width, bounds. Each kind has the following additional properties.

Button
name, visible, enabled
Radio Button
name, visible, enabled, value
Checkbox
name, visible, enabled, value
Pop-up Menu
name, visible, enabled
Scroll Bar
name, visible, enabled, value, minimum, maximum
Custom Control
name, visible, enabled, value, minimum, maximum
Text Entry Box
item text
Static Text
item text
Icon
[just the 5 basic]
Picture
[just the 5 basic]
User Item
[just the 5 basic]

Menus have fewer properties:

Menu
name, kind, enabled, quantity
Submenu
name, kind, enabled, quantity
Menu Item
name, kind, enabled, checked, mark

Independent of kind, windows or dialogs have the following properties:

any
name, kind, active, visible, location, height, width, bounds

Examples

kind of (get info dialog item 14)
checked of (get info menu item "Geneva" of menu "Font")
height of (get info window "Untitled")

Notes

Property Descriptions

active: whether or not a window is active (frontmost)
bounds: rectangle coordinates (top, left, bottom, right)
checked: whether or not a menu item is checked
enabled: whether or not an item is enabled
height: height in pixels
item text: text contents
kind: the kind of item
location: XY coordinates of upper left corner
mark: the kind of mark on a menu item
maximum: maximum value (for a control)
minimum: minimum value (for a control)
name: item name
quantity: number of items
value: item value
visible: whether or not item is visible
width: width in pixels

| Top |


Chapter 5, Verbs| Prev | Home | Next |Appendix 1, Questions & Answers

Updated on 1/24/99 by Scott S. Lawton (ssl@prefab.com)

Copyright 1993-99, PreFab Software, Inc. All Rights Reserved.

This site built and maintained using Stage Three, a set of custom Frontier scripts.