Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Commands

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

set

set [the] property to expression set [the] property of object ¬ to expression
set 
[the] property of window ¬ to expression set [the] property of [menuItem of] ¬ menu to expression set [the] property of chunk ¬ of field to expression

Note: expression must yield a valid setting for the specified property.

The set command changes the state of a specified property. If the object or element to which the property belongs is not specified, the property must be a global property or painting property.

You can use the Info dialog box of an object to set many of its properties.


Examples

set the userLevel to 5
set the style of bkgnd button 1 to rectangle
set the wideMargins of card field id 34 to true
set the cantModify of this stack to true

set the top of Message box to (bottom of this card + 12)
set the scroll of card window to 0,0

set the enabled of menu 2 to false
set the cmdChar of first menuItem of second menu to "0"

set the textSize of field "Index" to (the textSize of field "Index" + 4)
set the textStyle of the clickChunk to bold
set the visible of menuBar to false

Demo Script

on madScroller
   put the rect of card window into theRect
   set the rect of card window to left of cd window,top of cd window,¬
   left of cd window + 172, top of cd window + 64
   repeat 10 times
     set the scroll of card window to ¬
     random(width of this card),random(height of this card)
     wait 30
   end repeat
   set the rect of card window to theRect
 end madScroller

Placeholders

property
HyperTalk DefinitionA literal string that names a characteristic of an object (for example, a field or button property) or of HyperCard itself (called a global property).

Properties vary depending on the object and include

the location
the rectangle
the name
the textArrows
the userLevel
AppleScript DefinitionA characteristic of an object that has a single value and is identified by a label.

expression
HyperTalk DefinitionAny HyperTalk expression. All expressions evaluate to text, a number, or a constant.

For example:

true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024


Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1. In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions.

AppleScript DefinitionAny series of words that has a value.

object
HyperTalk DefinitionThe object HyperCard, or any expression that identifies an object by name, number, or id.

For example:

HyperCard
me
[the] target
button 1
background part 6
card field id 3894
this card
next background
stack "My Stack"
AppleScript DefinitionAn identifiable part of an application, or a thing within an application that can respond to commands.

window
One of HyperCard’s built-in windows, the window containing the current stack (called the card window), or any other window containing a stack, as follows:

card window
tool window
window "tools"
pattern window
window "Patterns"
scroll window
window "scroll"
[the] message [window]
[the] message [box]
[the] msg [window]
[the] msg [box]
window "message"
message watcher
window "message watcher"
variable watcher
window "variable watcher"
window "Home"
window "Readymade Buttons"
-- if longWindowTitles is true:
window "My HD:Home"
window 6
window ID 21403082
Note: If a window containing a stack is inactive, you can set only its location and visible properties.
Important: External windows can’t be substituted for the window placeholder (see the externalWindow placeHolder).

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


chunk
One of the following forms (or combinations thereof):

ordinal charactercharacter posInteger [to posInteger ]ordinal wordword posInteger [to posInteger ]ordinal itemitem posInteger [to posInteger ]ordinal lineline posInteger [to posInteger ]

For example:

first character
second item
middle line
character 1
char 1 to 10
word 3
item 5 to (the number of items of me)
line 1 to 10
char 1 to 10 of word 2 to 4 of ¬
line 3 to 6
A chunk combined with of and a container is called a chunk expression. For example:
line 1 of card field "index"


Important: You can’t combine a stack name with a chunk expression—you can only refer to a chunk in the current stack.

field
An expression that identifies a field by name, number, or id using one of the following forms (in AppleScript, use “background” in place of “bkgnd”):

card field id posInteger [of card ]card field text [of card ] -- namecard field posInteger [of card ]ordinal card field [of card ]

[bkgnd] field id posInteger [of card ][bkgnd] field text [of card ] -- name[bkgnd] field posInteger [of card ]ordinal [bkgnd] field [of card ]

For example:

card field id 3894
card field "My Notes"
card field 1
first card field
background field 3 of card 1
When used inside a field script in HyperTalk:
me
When a field receives a message:[the] target

A field can also be referred to as a part when you’re talking about its position among all buttons and fields within the same card or background.

Related Topics

« select | HyperTalk Reference | show »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Commands

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

set

set [the] property to expression set [the] property of object ¬ to expression
set 
[the] property of window ¬ to expression set [the] property of [menuItem of] ¬ menu to expression set [the] property of chunk ¬ of field to expression

Note: expression must yield a valid setting for the specified property.

The set command changes the state of a specified property. If the object or element to which the property belongs is not specified, the property must be a global property or painting property.

You can use the Info dialog box of an object to set many of its properties.


Examples

set the userLevel to 5
set the style of bkgnd button 1 to rectangle
set the wideMargins of card field id 34 to true
set the cantModify of this stack to true

set the top of Message box to (bottom of this card + 12)
set the scroll of card window to 0,0

set the enabled of menu 2 to false
set the cmdChar of first menuItem of second menu to "0"

set the textSize of field "Index" to (the textSize of field "Index" + 4)
set the textStyle of the clickChunk to bold
set the visible of menuBar to false

Demo Script

on madScroller
   put the rect of card window into theRect
   set the rect of card window to left of cd window,top of cd window,¬
   left of cd window + 172, top of cd window + 64
   repeat 10 times
     set the scroll of card window to ¬
     random(width of this card),random(height of this card)
     wait 30
   end repeat
   set the rect of card window to theRect
 end madScroller

Placeholders

property
HyperTalk DefinitionA literal string that names a characteristic of an object (for example, a field or button property) or of HyperCard itself (called a global property).

Properties vary depending on the object and include

the location
the rectangle
the name
the textArrows
the userLevel
AppleScript DefinitionA characteristic of an object that has a single value and is identified by a label.

expression
HyperTalk DefinitionAny HyperTalk expression. All expressions evaluate to text, a number, or a constant.

For example:

true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024


Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1. In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions.

AppleScript DefinitionAny series of words that has a value.

object
HyperTalk DefinitionThe object HyperCard, or any expression that identifies an object by name, number, or id.

For example:

HyperCard
me
[the] target
button 1
background part 6
card field id 3894
this card
next background
stack "My Stack"
AppleScript DefinitionAn identifiable part of an application, or a thing within an application that can respond to commands.

window
One of HyperCard’s built-in windows, the window containing the current stack (called the card window), or any other window containing a stack, as follows:

card window
tool window
window "tools"
pattern window
window "Patterns"
scroll window
window "scroll"
[the] message [window]
[the] message [box]
[the] msg [window]
[the] msg [box]
window "message"
message watcher
window "message watcher"
variable watcher
window "variable watcher"
window "Home"
window "Readymade Buttons"
-- if longWindowTitles is true:
window "My HD:Home"
window 6
window ID 21403082
Note: If a window containing a stack is inactive, you can set only its location and visible properties.
Important: External windows can’t be substituted for the window placeholder (see the externalWindow placeHolder).

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


chunk
One of the following forms (or combinations thereof):

ordinal charactercharacter posInteger [to posInteger ]ordinal wordword posInteger [to posInteger ]ordinal itemitem posInteger [to posInteger ]ordinal lineline posInteger [to posInteger ]

For example:

first character
second item
middle line
character 1
char 1 to 10
word 3
item 5 to (the number of items of me)
line 1 to 10
char 1 to 10 of word 2 to 4 of ¬
line 3 to 6
A chunk combined with of and a container is called a chunk expression. For example:
line 1 of card field "index"


Important: You can’t combine a stack name with a chunk expression—you can only refer to a chunk in the current stack.

field
An expression that identifies a field by name, number, or id using one of the following forms (in AppleScript, use “background” in place of “bkgnd”):

card field id posInteger [of card ]card field text [of card ] -- namecard field posInteger [of card ]ordinal card field [of card ]

[bkgnd] field id posInteger [of card ][bkgnd] field text [of card ] -- name[bkgnd] field posInteger [of card ]ordinal [bkgnd] field [of card ]

For example:

card field id 3894
card field "My Notes"
card field 1
first card field
background field 3 of card 1
When used inside a field script in HyperTalk:
me
When a field receives a message:[the] target

A field can also be referred to as a part when you’re talking about its position among all buttons and fields within the same card or background.

Related Topics

« select | HyperTalk Reference | show »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View