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.

open

open application
open fileName with application
The open command launches another application program or opens a document with another application from within HyperCard. You must provide the full path names for the files if they’re not at the same directory level as HyperCard.

Under the Finder in System 6, HyperCard sends the suspend system message to the current card before turning over control to the application.

If HyperCard can’t find the document or 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 specified application (for example, there’s not enough memory), it sets the result to "Couldn't open that application."


Examples

open "TeachText"
open "Read Me" with "Teach Text"
open "the document you want" with "the application" -- invoke dialog box

answer file "Start what application?" of type application
if it is not empty then open it

Demo Script

on mouseUp
   -- this demo only works with System 7 
   if not systemSeven() then exit mouseUp
   -- asks the user for an application
   put askForApplication() into appName
   if appName is empty then exit mouseUp
   open appName -- open the selected application
   wait 5
   open the long name of HyperCard -- bring HyperCard to front
   wait 30
   close appName -- close the just opened application
 end mouseUp
 

 function askForApplication
   answer file "Select an application to open:" of type "APPL"
   if it is empty then return empty
   if it is the long name of HyperCard then
     -- the user selected the current running HyperCard
     answer "Try selecting an application other than HyperCard."
     return askForApplication() -- recursion
   else return it
 end askForApplication
 

 function systemSeven
   return the systemVersion ≥ 7.0
 end systemSeven

Placeholders

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"


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"


Related Topics

« multiply | HyperTalk Reference | open file »


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.

open

open application
open fileName with application
The open command launches another application program or opens a document with another application from within HyperCard. You must provide the full path names for the files if they’re not at the same directory level as HyperCard.

Under the Finder in System 6, HyperCard sends the suspend system message to the current card before turning over control to the application.

If HyperCard can’t find the document or 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 specified application (for example, there’s not enough memory), it sets the result to "Couldn't open that application."


Examples

open "TeachText"
open "Read Me" with "Teach Text"
open "the document you want" with "the application" -- invoke dialog box

answer file "Start what application?" of type application
if it is not empty then open it

Demo Script

on mouseUp
   -- this demo only works with System 7 
   if not systemSeven() then exit mouseUp
   -- asks the user for an application
   put askForApplication() into appName
   if appName is empty then exit mouseUp
   open appName -- open the selected application
   wait 5
   open the long name of HyperCard -- bring HyperCard to front
   wait 30
   close appName -- close the just opened application
 end mouseUp
 

 function askForApplication
   answer file "Select an application to open:" of type "APPL"
   if it is empty then return empty
   if it is the long name of HyperCard then
     -- the user selected the current running HyperCard
     answer "Try selecting an application other than HyperCard."
     return askForApplication() -- recursion
   else return it
 end askForApplication
 

 function systemSeven
   return the systemVersion ≥ 7.0
 end systemSeven

Placeholders

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"


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"


Related Topics

« multiply | HyperTalk Reference | open file »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View