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.

print

print card [from point1 to point2]
print all cards
print marked cards
print posInteger cards
print card [from point1 to point2]
print {field | button }
print fileName with application
print expression

The print command prints card images, the contents of fields and buttons, documents from other programs, or the value of any HyperTalk expression.

Print card prints an image of the current card. The option from point1 to point2 specifies a rectangular area of the card.

Print all cards prints the image of every card in the stack.

Print marked cards prints a subset of the cards in the stack based on each card’s marked property (as reflected in its Card Info dialog box). You can mark cards with the mark command.

Print posInteger cards prints a range of consecutive cards starting from the current card.

Print card prints the card specified by the card expression. The option from point1 to point2 specifies a rectangular area of the card. HyperCard sets the function the result to "No such card." if the specified card doesn’t exist; otherwise, the result returns empty.

Print button prints the contents of the specified button.

Print field prints the contents of the specified field, preserving the fonts, sizes, and styles of text used in the field.

Print file with application prints a document using another program. HyperCard launches the application; the application tries to print the document. (The user might see a Print dialog box.)

If HyperCard can't find either the document or the application, it displays a directory dialog box and asks the user to find it.

HyperCard also sets the result to Cancel if the user clicks Cancel in the dialog box. Otherwise, it sets the result to empty.

If HyperCard has problems opening the application (for example, there’s not enough memory), it sets the result to "Couldn't open that application."

After printing, the application program quits, and control returns to HyperCard.

Finally, print expression prints the value of any HyperTalk expression. You can print the values of local and global variables, fields, chunk expressions, the current selection, the contents of the Message box, and the result of any function or property.

Expressions are printed using the settings in printMargins, printTextAlign, printTextFont, printTextSize, printTextHeight, and printTextStyle.


Examples

print card
print card from 0,0 to 100,100
print card from topLeft of this card to the clickLoc

print first card
print this card
print card id 19390 from 90,0 to 180,180

-- Print marked cards:
print marked cards -- all of them
print next marked card
print second marked card
print marked card 5

print 10 cards
print (the number of cards of this bg) cards

-- Print a document using another program:
print "Read Me" with "Teach Text"
if the result is not empty then ... -- didn't print it

-- Print a field (preserves text styles):
print background field 1


-- Print any expression (no text styles):
print card field 1 & return & card field 2
print the selection
print the Message box
print "Hello there world"
print myVariable

Demo Script

on printDemo
   answer "Are you connected to a printer?" with "No" or "Yes"
   if it is "No" then exit printDemo
   lock screen
   open printing
   repeat with cardOffSet = 0 to 2
     print card (the number of this card + cardOffSet)
   end repeat
   close printing
   unlock screen
 end printDemo

Placeholders

posInteger
An expression that evaluates to a positive integer.

For example:
3
67 mod 13
the number of bg fields
the number of backgrounds
the number of cards div 2
See also: background, bkgnd, button, card, chunk, field, menu, and menuItem

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

recent card
back
forth
card id posInteger [of bkgnd ]card text [of bkgnd ] -- namecard posInteger [of bkgnd ] -- numberordinal card [of bkgnd ]position card [of bkgnd ]

ordinal marked cardposition marked cardmarked card posInteger

For example:

card id 3894
card "Index"
card 1 of background 1
prev card
previous card of this background
next card
this card
first card
last card
middle card
any card
first marked card
last marked card
next marked card
previous marked card
marked card 1
marked card (the number of marked cards)
When used inside a card script in HyperTalk:
me
When a card receives a message:
[the] target
See also: button and field

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.

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”.

fileName
An expression that evaluates to a text string that is also a valid Macintosh filename.

For example:

"my stack"
"HD20:Wally's Stacks:my stack"
"my file alias"


application
An expression that evaluates to a text string and that is also the name of a Macintosh application.

"MicroSoft Word"
"HD20:Applications:MacWrite"
"Claris MacWrite alias"


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

« pop | HyperTalk Reference | push »


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.

print

print card [from point1 to point2]
print all cards
print marked cards
print posInteger cards
print card [from point1 to point2]
print {field | button }
print fileName with application
print expression

The print command prints card images, the contents of fields and buttons, documents from other programs, or the value of any HyperTalk expression.

Print card prints an image of the current card. The option from point1 to point2 specifies a rectangular area of the card.

Print all cards prints the image of every card in the stack.

Print marked cards prints a subset of the cards in the stack based on each card’s marked property (as reflected in its Card Info dialog box). You can mark cards with the mark command.

Print posInteger cards prints a range of consecutive cards starting from the current card.

Print card prints the card specified by the card expression. The option from point1 to point2 specifies a rectangular area of the card. HyperCard sets the function the result to "No such card." if the specified card doesn’t exist; otherwise, the result returns empty.

Print button prints the contents of the specified button.

Print field prints the contents of the specified field, preserving the fonts, sizes, and styles of text used in the field.

Print file with application prints a document using another program. HyperCard launches the application; the application tries to print the document. (The user might see a Print dialog box.)

If HyperCard can't find either the document or the application, it displays a directory dialog box and asks the user to find it.

HyperCard also sets the result to Cancel if the user clicks Cancel in the dialog box. Otherwise, it sets the result to empty.

If HyperCard has problems opening the application (for example, there’s not enough memory), it sets the result to "Couldn't open that application."

After printing, the application program quits, and control returns to HyperCard.

Finally, print expression prints the value of any HyperTalk expression. You can print the values of local and global variables, fields, chunk expressions, the current selection, the contents of the Message box, and the result of any function or property.

Expressions are printed using the settings in printMargins, printTextAlign, printTextFont, printTextSize, printTextHeight, and printTextStyle.


Examples

print card
print card from 0,0 to 100,100
print card from topLeft of this card to the clickLoc

print first card
print this card
print card id 19390 from 90,0 to 180,180

-- Print marked cards:
print marked cards -- all of them
print next marked card
print second marked card
print marked card 5

print 10 cards
print (the number of cards of this bg) cards

-- Print a document using another program:
print "Read Me" with "Teach Text"
if the result is not empty then ... -- didn't print it

-- Print a field (preserves text styles):
print background field 1


-- Print any expression (no text styles):
print card field 1 & return & card field 2
print the selection
print the Message box
print "Hello there world"
print myVariable

Demo Script

on printDemo
   answer "Are you connected to a printer?" with "No" or "Yes"
   if it is "No" then exit printDemo
   lock screen
   open printing
   repeat with cardOffSet = 0 to 2
     print card (the number of this card + cardOffSet)
   end repeat
   close printing
   unlock screen
 end printDemo

Placeholders

posInteger
An expression that evaluates to a positive integer.

For example:
3
67 mod 13
the number of bg fields
the number of backgrounds
the number of cards div 2
See also: background, bkgnd, button, card, chunk, field, menu, and menuItem

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

recent card
back
forth
card id posInteger [of bkgnd ]card text [of bkgnd ] -- namecard posInteger [of bkgnd ] -- numberordinal card [of bkgnd ]position card [of bkgnd ]

ordinal marked cardposition marked cardmarked card posInteger

For example:

card id 3894
card "Index"
card 1 of background 1
prev card
previous card of this background
next card
this card
first card
last card
middle card
any card
first marked card
last marked card
next marked card
previous marked card
marked card 1
marked card (the number of marked cards)
When used inside a card script in HyperTalk:
me
When a card receives a message:
[the] target
See also: button and field

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.

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”.

fileName
An expression that evaluates to a text string that is also a valid Macintosh filename.

For example:

"my stack"
"HD20:Wally's Stacks:my stack"
"my file alias"


application
An expression that evaluates to a text string and that is also the name of a Macintosh application.

"MicroSoft Word"
"HD20:Applications:MacWrite"
"Claris MacWrite alias"


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

« pop | HyperTalk Reference | push »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View