Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Functions

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

number

the number of [card] {buttons|parts}
the number of bkgnd {buttons|parts}
the number of card fields
the number of [bkgnd] fields

the number of marked cards the number of cards [in bkgnd] ¬
   [of this stack]
the number of bkgnds [of this stack]

the number of windows
the number of menus
the number of menuItems of menu
the number of chunks in expression

Values returned: A non-negative integer equal to one of the following:

  • total number of buttons or fields on the current card or background
  • total number of parts (buttons and fields combined) on the current card or background
  • total number of marked cards, cards in a specific background, cards in an entire stack, or backgrounds in a stack
  • number of all the windows (including built-in palettes and external windows) in HyperCard
  • number of menus in the menu bar or the number of menu items in a specified menu
  • total number of characters, words, items, or lines in the value of any HyperTalk expression (treated as text)

Demo Script

on numberOfChunks
   get bkgnd field "Demo Script"
   answer "There are" && the number of lines in it && ¬
   "lines and" && the number of words in it && "words and" && ¬
   the number of characters in it && "characters in this handler."
 end numberOfChunks

Placeholders

bkgnd
A HyperTalk expression that identifies a background by name, number, or id, using one of the following forms:

bkgnd id posInteger
bkgnd text -- name
bkgnd posInteger -- number
ordinal bkgnd
position bkgnd


For example:
bkgnd id 3894
bkgnd "Index"
bkgnd 1
prev bkgnd
previous bkgnd
next bkgnd
this bkgnd
first bkgnd
last bkgnd
middle bkgnd
any bkgnd
From within a background script, the term me refers to that background.
When a background receives a the message [the] target, that message is referring to the background.

See also: card

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


chunks
One of the following:

characters
chars
words
items
lines


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.

Related Topics

« mouseLoc | HyperTalk Reference | numToChar »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Functions

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

number

the number of [card] {buttons|parts}
the number of bkgnd {buttons|parts}
the number of card fields
the number of [bkgnd] fields

the number of marked cards the number of cards [in bkgnd] ¬
   [of this stack]
the number of bkgnds [of this stack]

the number of windows
the number of menus
the number of menuItems of menu
the number of chunks in expression

Values returned: A non-negative integer equal to one of the following:


Demo Script

on numberOfChunks
   get bkgnd field "Demo Script"
   answer "There are" && the number of lines in it && ¬
   "lines and" && the number of words in it && "words and" && ¬
   the number of characters in it && "characters in this handler."
 end numberOfChunks

Placeholders

bkgnd
A HyperTalk expression that identifies a background by name, number, or id, using one of the following forms:

bkgnd id posInteger
bkgnd text -- name
bkgnd posInteger -- number
ordinal bkgnd
position bkgnd


For example:
bkgnd id 3894
bkgnd "Index"
bkgnd 1
prev bkgnd
previous bkgnd
next bkgnd
this bkgnd
first bkgnd
last bkgnd
middle bkgnd
any bkgnd
From within a background script, the term me refers to that background.
When a background receives a the message [the] target, that message is referring to the background.

See also: card

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


chunks
One of the following:

characters
chars
words
items
lines


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.

Related Topics

« mouseLoc | HyperTalk Reference | numToChar »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View