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.

select

select empty
select button
select field
select text of container
select before text of container
select after text of container
select chunk of container
select before chunk of container
select after chunk of container

Note: container cannot be a variable.

The select command selects buttons, fields, or text.

Select button selects a button as if you had chosen the Button tool and clicked it. Select field selects a field as if you had chosen the Field tool and clicked it.

Note: You can’t use select to select hidden buttons or fields, and the user level must be set to Authoring or Scripting for select to work.

Select empty removes the current selection. Use select empty instead of click at to deselect text or objects.

Select text applies to all the text in a field or in the Message box. You can select all the text or place the insertion point before the first character or after the last character of text.

Select chunk applies to a specified range of text in the Message box or in a field, to one or more lines in a list field, or to a line (that is, a “menu” item) in a popup button.

In the Message box or in a field you can select the entire range of text or place the insertion point before the first character or after the last character of the range.


Examples

-- Select a button or a field:
select background button id 12
select card field 1
select me

select empty

-- Set the insertion point in a field:
select before word 2 of field "syntax"
select after line 1 of first field
select after text of cd fld id 2378 

-- Select a range of text in a field or msg box:
select char 1 of field "syntax"
select item 2 of field "names"
select word 4 to 9 of message box
select text of me -- from a script
select text of target -- from a script
select line 1 of me -- from a script
select line 3 to 6 of field "Choices" -- in a list field

-- Select a line in a pop-up menu:
select line 3 of button "Maps"

Demo Script

on selectDemo
   -- select an object and move it:
   select bkgnd button "Run the Script"
   set dragSpeed to 60
   drag from 386,255 to 386,75
   wait 1 second
   domenu "undo"
   

   -- select a range of characters:
   set cursor to watch
   select char 181 to 210 of bkgnd field "Demo Script"
   wait 2 seconds
   select empty
 end selectDemo

Placeholders

button
HyperTalk DefinitionAn expression that identifies a button by name, number, or id, using one of the following forms:

[card] button id posInteger [of card ][card] button text [of card ] -- name[card] button posInteger [of card ]ordinal [card] button [of card ]

bkgnd
button id posInteger [of card ]bkgnd button text [of card ] -- namebkgnd button posInteger [of card ]ordinal bkgnd button [of card ]For example:

card button id 3894
card button "Return"
card button 1
first card button
bkgnd button 2 of card 2
last bkgnd button
When used inside a button script:
me
When a button receives a message:
[the] target
A button 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.

AppleScript DefinitionAn expression that identifies a button by name, number, or id, using the same forms as HyperTalk except that “background” must be used in place of “bkgnd”.

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.

container
HyperTalk DefinitionA place where you can store and retrieve a value.

There are six types of containers in HyperCard: a variable, a button, a field, the selection, the Message box, and menus.

myVariable
[the] selection
the Message box
btn 3
bg btn "Names"
card field 1
bkgnd field "Total"
menu 2
menu "Edit"
Additionally, you can refer to a button or field by its part number:

card part 1
last background part
AppleScript DefinitionAn object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words of or in.

You can also use the possesive form ('s) to specify containers. For example, in

first window's name
the container is first window. The object it contains is a name property.

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.

Related Topics

« save | HyperTalk Reference | set »


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.

select

select empty
select button
select field
select text of container
select before text of container
select after text of container
select chunk of container
select before chunk of container
select after chunk of container

Note: container cannot be a variable.

The select command selects buttons, fields, or text.

Select button selects a button as if you had chosen the Button tool and clicked it. Select field selects a field as if you had chosen the Field tool and clicked it.

Note: You can’t use select to select hidden buttons or fields, and the user level must be set to Authoring or Scripting for select to work.

Select empty removes the current selection. Use select empty instead of click at to deselect text or objects.

Select text applies to all the text in a field or in the Message box. You can select all the text or place the insertion point before the first character or after the last character of text.

Select chunk applies to a specified range of text in the Message box or in a field, to one or more lines in a list field, or to a line (that is, a “menu” item) in a popup button.

In the Message box or in a field you can select the entire range of text or place the insertion point before the first character or after the last character of the range.


Examples

-- Select a button or a field:
select background button id 12
select card field 1
select me

select empty

-- Set the insertion point in a field:
select before word 2 of field "syntax"
select after line 1 of first field
select after text of cd fld id 2378 

-- Select a range of text in a field or msg box:
select char 1 of field "syntax"
select item 2 of field "names"
select word 4 to 9 of message box
select text of me -- from a script
select text of target -- from a script
select line 1 of me -- from a script
select line 3 to 6 of field "Choices" -- in a list field

-- Select a line in a pop-up menu:
select line 3 of button "Maps"

Demo Script

on selectDemo
   -- select an object and move it:
   select bkgnd button "Run the Script"
   set dragSpeed to 60
   drag from 386,255 to 386,75
   wait 1 second
   domenu "undo"
   

   -- select a range of characters:
   set cursor to watch
   select char 181 to 210 of bkgnd field "Demo Script"
   wait 2 seconds
   select empty
 end selectDemo

Placeholders

button
HyperTalk DefinitionAn expression that identifies a button by name, number, or id, using one of the following forms:

[card] button id posInteger [of card ][card] button text [of card ] -- name[card] button posInteger [of card ]ordinal [card] button [of card ]

bkgnd
button id posInteger [of card ]bkgnd button text [of card ] -- namebkgnd button posInteger [of card ]ordinal bkgnd button [of card ]For example:

card button id 3894
card button "Return"
card button 1
first card button
bkgnd button 2 of card 2
last bkgnd button
When used inside a button script:
me
When a button receives a message:
[the] target
A button 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.

AppleScript DefinitionAn expression that identifies a button by name, number, or id, using the same forms as HyperTalk except that “background” must be used in place of “bkgnd”.

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.

container
HyperTalk DefinitionA place where you can store and retrieve a value.

There are six types of containers in HyperCard: a variable, a button, a field, the selection, the Message box, and menus.

myVariable
[the] selection
the Message box
btn 3
bg btn "Names"
card field 1
bkgnd field "Total"
menu 2
menu "Edit"
Additionally, you can refer to a button or field by its part number:

card part 1
last background part
AppleScript DefinitionAn object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words of or in.

You can also use the possesive form ('s) to specify containers. For example, in

first window's name
the container is first window. The object it contains is a name property.

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.

Related Topics

« save | HyperTalk Reference | set »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View