Professional Documents
Culture Documents
Sense Talk
Sense Talk
Overview
The following list provides a very brief overview of some of the more
significant features of the SenseTalk scripting language provided in
HyperSense:
Each objects' script can include one or more message handlers for
Event-driven:
Message-passing hierarchy:
____________________________________________
Script of a button that sorts all of the pages in a stack into ascending
order based on the last word in the text of the "Name" field on each
page:
onmouseUp
sortpagesbythelastwordoffield"Name"
endmouseUp
____________________________________________
Script of a field which redisplays its contents in a long date format
whenever it is edited (a "closeField" message is sent to a field
whenever a user has changed the text in the field):
oncloseField
convertmetolongdate
endcloseField
____________________________________________
Script of a field which checks that the contents of the field are a date
whenever the field is edited. If the new contents are not a valid
date, the script beeps and reselects the text of the field:
oncloseField
ifmeisnotadatethen
beep
selectthetextofme
endif
endcloseField
____________________________________________
Script of a page which does some initialization each time a user
navigates to that page :
onopenPage
hideouroverlays,leavingonlytheskeletonshowing
hidelayer"Organs"
hidelayer"Muscle"
hidelayer"Skin"
enableanddisabletheappropriatebuttons
disablebutton"RevealSkeleton"
enablebutton"ShowOrgans"
enablebutton"ShowMuscle"
enablebutton"ShowSkin"
endopenPage
____________________________________________
Script of a button that calculates the total of the amounts entered in
the "Net Due" field on each page of a stack, when the shift key is not
being pressed. If the shift key is held down while the button is
clicked, it calculates the average instead of the total. In either case,
the result of the calculation is presented in a small modal panel on
the screen.
This somewhat contrived example shows the use of multiple
message handlers within a single script, and also shows how a
handler can send a message to execute another handler :
onmouseUp
iftheshiftKeyisnotdownthen
calculateTotalsenda"calculateTotal"message
else(theshiftKeyISdown,socalculatetheaverage)
calculateAverage
endif
endmouseUp
thenexthandlerisactivatedbythe"calculateTotal"message:
oncalculateTotal
putzerointototalstartoursumatzero
now,stepthroughallofthepagesinourstack...
repeatwithn=1tothenumberofpages
addfield"NetDue"ofpagentototal
endrepeat(markstheendoftherepeatedcommands)
finally,displaytheresult:
answer"Thetotaldueis"&total
endcalculateTotal
oncalculateAveragehandlethe"calculateAverage"message
putzerointototal
repeatwithn=1tothenumberofpages
addfield"NetDue"ofpagentototal
endrepeat
dividetotalbythenumberofpages
answer"Theaverageamountdueis"&total
endcalculateAverage
____________________________________________
STBrowser.tiff
The language elements listed here are presented in more depth,
including brief descriptions and code templates, in the SenseTalk
Browser panel within HyperSense. For further reference it is
suggested you browse there, as well as in the on-line manual.
System Messages
System Messages are the messages which are sent automatically by
HyperSense to various objects to notify them of events which have
occurred. Handlers for these event messages form the starting point
for all SenseTalk scripts.
sent to All Elements
firstMouseDown
mouseDown
mouseStillDown
mouseDragged
mouseUp
mouseRelease
mouseEnter
mouseWithin
mouseLeave
contextHelp
newElement
deleteElement
sent to Buttons
newButton
deleteButton
sent to Fields
newField
deleteField
enterInField
returnInField
openField
closeField
exitField
tabKey
keyDown
sent to Sliders
newSlider
deleteSlider
mouseDragged
mouseUp
valueChanged
sent to Browsers
newBrowser
deleteBrowser
mouseUp
mouseDoubleClick
sent to Graphics
newGraphic
deleteGraphic
sent to StackViewers
newStackViewer
deleteStackViewer
stackViewerWillOpen
stackViewerWillClose
sent to Layers
newSharedLayer
deleteSharedLayer
newUniqueLayer
deleteUniqueLayer
newWindowFrameLayer
deleteWindowFrameLayer
openSharedLayer
closeSharedLayer
openUniqueLayer
closeUniqueLayer
openWindowFrameLayer
closeWindowFrameLayer
hideLayer
showLayer
sent to a Page
openPage
closePage
newPage
deletePage
sent to Current Page
startUp
idle
returnKey
enterKey
tabKey
arrowKey
keyDown
modifierKeysChanged
doMenu
newStack
deleteStack
openStack
closeStack
help
contextHelp
scriptHelp
senseTalkHelp
systemHelp
becomeCurrentStack
resignCurrentStack
showAlignmentPanel
showLinker
showTools
showDocTools
sent to Stacks
openStackInDocument
closeStackInDocument
sent to Documents
documentWillOpen
openDocument
closeDocument
openDocumentAsResource
closeDocumentAsResource
sent to WindowFrames
newWindowFrame
deleteWindowFrame
openWindowFrame
closeWindowFrame
openWindow
becomeMainWindow
resignMainWindow
sent to Any object
notifyOnPort
timer
Keywords
Keywords provide the basic framework of message handlers within a
script. Keywords and Constants are the only SenseTalk words which
are "reserved" and may not be used as variable names.
on...end
function...end
global
pass
return
do
send
[ ] (send a "function" message to a specific object)
if...then
if...then...else
repeat n times...end
repeat with...end
repeat until...end
repeat while...end
next repeat
exit repeat
exit handlerName
exit to HyperSense
Commands
Commands are the action words of the SenseTalk language. This list
presents the commands which are built into HyperSense itself,
arranged in functional groups. You can also create your own
commands, written either in SenseTalk or in Objective C (through
HyperSense's dynamically-loaded XModule capability).
Sending Messages
message
send
[]
Arithmetic
add
subtract
multiply
divide
User Interaction
answer
answer from list
answer multiple from list
ask
beep
play
put
Navigation
go
go to document
go back
go forth
pop page
push
help
find
find in field
open application
delete object
delete variable
doShell (execute Unix shell commands)
doShell into container
hide object
lock screen
print page
print page to device
remove
reorder
reorder layer
reorder to position
select text of a field
select part of a field
select position in a field
select position within a field
show object
show element at location
sort items of a container
sort lines of a container
sort pages of a stack
unlock screen
File Input & Output
answer file
answer file (with panel title)
answer directory
ask file
ask file (with panel title)
close file
close all
open file
open file for a purpose
read for length
read at location for length
read until char
read until end
read at location until char
seek
seek relative
write
write at location
Serial Port Input & Output
open port
close port
read from port for max
read from port until char
write to port
Events & Simulation
arrowKey
choose
choose tool
click at
click multiple at point
click in context
doMenu
drag
drag in context
edit script
enterInField
enterKey
hide panel
keyDown
returnInField
returnKey
select element
select layer
show panel
scriptHelp
senseTalkHelp
systemHelp
tabKey
type
wait
wait until
wait while
Menu
create menu
put into menu
put after menuItem
delete menu
delete menu item
disable
enable
reset menus
Timer
start timer
stop timer
Functions
Functions return values stored or calculated by the system. This list
presents the functions which are built into HyperSense, arranged in
functional groups. You can also create your own functions, written
either in SenseTalk or in Objective C (through HyperSense's
dynamically-loaded XModule capability).
Arithmetic
abs
annuity
atan
average
compound
cos
exp
exp1
exp2
ln
ln1
log2
max
min
random
round
round to multiple
sin
sqrt
tan
trunc
String
charToNum
length
numToChar
offset
offset beyond position
Date & Time
date
localToGMOffset
seconds
ticks
time
Object
backList
forthList
menus
number
pushList
selectedElements
stacks
Event-related
alternateKey
clickChunk
clickH
clickLine
clickLoc
clickLoc in context
clickText
clickV
commandKey
controlKey
foundChunk
foundField
foundLine
foundText
mouse
mouseClick
mouseH
mouseLoc
mouseLoc in context
mouseV
optionKey
selectedChunk
selectedField
selectedLine
selectedText
shiftKey
sound
target
tool
Miscellaneous
openDocumentList
openFileList
param
paramCount
params
result
screenRect
value
Operators
Operators compute the result of some operation on one or two
operands. The operators available in SenseTalk are listed here.
+
*
/
(addition)
(subtraction)
(multiplication)
(division)
^
div
mod
=
<>
<
>
<=
>=
is
is not
and
or
not
&
&&
is in
contains
is not in
()
is within
(exponentiation)
(integer division)
(modulo)
(test for equality)
(test for inequality)
(test for less than)
(test for greater than)
(test for less than or equal to)
(test for greater than or equal to)
(test for equality)
(test for inequality)
(logical and)
(logical or)
(logical not)
(string concatenation)
(string concatenation)
(test for substring presence)
(test for substring presence)
(test for substring absence)
(operator grouping)
(test whether a point is within a rectangle)
is not within
is a
is not a
there is a
there is not a
there is no
Chunk Expressions
Chunk Expressions make it easy to work with the lines, items
(separated by commas or other specified delimiter), words, and
individual characters within a piece of text.
line chunk
line
ordinal line
line range
item chunk
item
ordinal item
item range
word chunk
word
ordinal word
word range
character chunk
character
ordinal character
character range
Sources of Value
Sources of value are the basic building blocks of expressions. In
addition to properties of objects (listed later) and functions (listed
earlier), SenseTalk recognizes these sources of values.
Literals
Numbers
Quoted Strings
Unquoted Strings
Constants
empty
return
tab
quote
space
comma
colon
formfeed
linefeed
pi
zero
one
two
three
four
five
six
seven
eight
nine
ten
up
down
true
false
Containers
local variables
global variables
owned variables
fields
the selection
chunks
Properties
Every object in a HyperSense document has various properties which
can be accessed or changed from within a script. In addition, there
are a number of Global Properties which represent global aspects of
the SenseTalk environment. The properties recognized by SenseTalk
are listed here, grouped by the kind of object they apply to. You can
hideUnused
All Objects
name
long name
short name
abbreviated name
id
long id
short id
abbreviated id
local id
variableList
WindowFrame
allowClones
autoHide
canBeClosed
canMiniaturize
canResize
resizable
floating
fullSize
isPanel
rememberLocation
showName
maxSize
minSize
maxWidth
minWidth
maxHeight
minHeight
miniatureIcon
grid
showGrid
gridColor
gridSize
gridX
gridY
gridIsSquare
gridOnTop
StackViewer
borderStyle
scrollStyle
assignedStack
assignedPage
Stack
newPagesAtEnd
rememberOpenPage
sameSizePages
standardPageSize
showFoundFields
protoPage
useProtoPage
grid
showGrid
gridColor
gridSize
gridX
gridY
gridIsSquare
gridOnTop
Page
dontSearch
marked
paperColor
top
bottom
left
right
topLeft
topRight
bottomLeft
bottomRight
location
rectangle
width
height
size
Layers and Elements
dontPrint
autosizing (WindowFrame Elements only)
hidden
ignoreMouseAlways
ignoreMouseWhenHidden
visible
top
bottom
left
right
topLeft
topRight
bottomLeft
bottomRight
location
rectangle
width
height
size
Tool Elements
isTool
toolType
Graphics
color
lineColor
textColor
bgColor
fillColor
filled
framed
lineArrow
lineCap
lineDash
lineJoin
lineSize
lineWidth
startPoint (Line Graphics)
endPoint (Line Graphics)
startAngle (Ovals)
endAngle (Ovals)
closed (Polygons & Freehands)
points (Polygons & Freehands)
ImageElement
image
scrollX
scrollY
scaleX
scaleY
autoScale
borderStyle
bgColor
color
sharedImage
Field
returnAdvance
autoTab
tabAdvance
dontSearch
dontWrap
editable
selectable
lockText
monofont
rtf
scrollable (horizontally)
scroll
sharedText
style
textAlign
textFont
textHeight
textSize
wideMargins
Button
state
highlight
toggleState
sharedState
showPress
borderStyle
showName
style
title
altTitle
pressesBy
changesBy
radioMode
icon
altIcon
iconPosition
textAlign
textFont
textSize
Browser
allowEmptySelect
allowMultiSelect
multiBranchSelect
contents
enabled
maxColumns
minColumnWidth
pathSeparator
selectedPath
selectedPathData
selectedItems
separateColumns
showName
title
titled
horizontalButtons
horizontalScroller
verticalButtons
verticalScrollers
Slider
currentValue
minValue
maxValue
stepValue
alternateStep
knobSize
enabled
reversed
sharedValue
showName
title
Document
userModeOnly
readOnly
Menu
enabled
name
MenuItem
commandChar
enabled
menuMessage
name
subMenu
Serial Port
baudRate
device
notify
notifyCount
notifyTarget
parity
status
Timer
period
target
status