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.

close

close printing
close file fileName
close [document { in | with } ] ¬
            application
close { externalWindow | card window}

The close printing command ends a print job previously begun with an open printing command.

The close file command closes a disk file previously opened with the open file command. Usually, you open files to import or export text. Always use close file when you’re finished.

If you try to close an unopened file, the result gets File not open.

HyperCard automatically closes all open files when

  • it runs an exit to HyperCard statement,
  • the user presses Command-. (Command-period), or
  • the user quits HyperCard.

You must provide the full path name of the file if it’s not at the same directory level as HyperCard.

The close [document {in|with}] application command closes the named running document, application, or desk accessory. (The words in and with are synonymous.)

Note: This command works only with Apple event-aware applications running under System 7 on the same Macintosh as HyperCard.

If the document or application isn’t running, the result is set to No such document or No such application as appropriate.

The form close application sends a quit Apple event, while the form close document {in|with} application sends a clos Apple event.

All Apple event-aware applications support the quit Apple event, but they don’t all support clos.

The close externalWindow command closes an external window—a palette or other window displayed by an external command or external function—and removes it from the window list.

Thus you can’t show an external window once you’ve closed it; you’ll have to create a new one using its external command or external function.

The close card window command closes the frontmost stack if at least two stacks are open.

HyperCard also sends the close command to the current card when the user clicks the close box of the card window. You can handle the message as follows:

on close
  statements
end close

Examples

close printing

close "MicroSoft Works"
close "Alarm Clock"

close file "My Data File"
close file "Simonides:Help Text"
close file theOpenFile

close window "Script of stack My HD:Home" -- external window
close window "Navigator" -- external window

close card window
close window "Home"

Placeholders

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"


externalWindow
A window displayed by an external command or an external function; a window that’s not one of HyperCard’s built-in windows :
window "navigator"
window "Script of stack My HD:Home"
window "JT's Cool Palette"
See also: window placeholder

statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« click at | HyperTalk Reference | commandKeyDown »


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.

close

close printing
close file fileName
close [document { in | with } ] ¬
            application
close { externalWindow | card window}

The close printing command ends a print job previously begun with an open printing command.

The close file command closes a disk file previously opened with the open file command. Usually, you open files to import or export text. Always use close file when you’re finished.

If you try to close an unopened file, the result gets File not open.

HyperCard automatically closes all open files when

You must provide the full path name of the file if it’s not at the same directory level as HyperCard.

The close [document {in|with}] application command closes the named running document, application, or desk accessory. (The words in and with are synonymous.)

Note: This command works only with Apple event-aware applications running under System 7 on the same Macintosh as HyperCard.

If the document or application isn’t running, the result is set to No such document or No such application as appropriate.

The form close application sends a quit Apple event, while the form close document {in|with} application sends a clos Apple event.

All Apple event-aware applications support the quit Apple event, but they don’t all support clos.

The close externalWindow command closes an external window—a palette or other window displayed by an external command or external function—and removes it from the window list.

Thus you can’t show an external window once you’ve closed it; you’ll have to create a new one using its external command or external function.

The close card window command closes the frontmost stack if at least two stacks are open.

HyperCard also sends the close command to the current card when the user clicks the close box of the card window. You can handle the message as follows:

on close
  statements
end close

Examples

close printing

close "MicroSoft Works"
close "Alarm Clock"

close file "My Data File"
close file "Simonides:Help Text"
close file theOpenFile

close window "Script of stack My HD:Home" -- external window
close window "Navigator" -- external window

close card window
close window "Home"

Placeholders

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"


externalWindow
A window displayed by an external command or an external function; a window that’s not one of HyperCard’s built-in windows :
window "navigator"
window "Script of stack My HD:Home"
window "JT's Cool Palette"
See also: window placeholder

statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« click at | HyperTalk Reference | commandKeyDown »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View