[comp.sys.mac.hypercard] Hypercard 2.1 & new file commands

David_Greg_Herlihy@cup.portal.com (05/11/91)

I noticed someone said something about enhanced open/close file commands
in HyperCard 2.1.  Could someone tell me how the new commands will differ?

Thanks.  David

jkc@Apple.COM (John Kevin Calhoun) (05/14/91)

In article <42224@cup.portal.com> David_Greg_Herlihy@cup.portal.com writes:
>I noticed someone said something about enhanced open/close file commands
>in HyperCard 2.1.  Could someone tell me how the new commands will differ?

When you run HyperCard 2.1 under System 6.x, the open and close commands behave
just as they do in HyperCard 2.0.

However, when you run HyperCard 2.1 under System 7.0, the open command will be
able to open a document within a "System 7 savvy" application that's already
running, through the use of the "open document" Apple event.  For example:

   open "Really zesty Quarterly Report" with "Claris Resolve"

(Apple events, by the way, are the most common means that 7.0 applications will
use to communicate with each other.  Many applications have already become
"System 7 savvy", such as Excel 3.0 and MacWrite Pro.)  

Similarly, you'll be able to print documents from these applications with the
print command, whether or not they're already running.  For example:

   print "Bob's amazing four-color chart" with "Excel 3.0"

Under 7.0, the close command will be able to close documents in some of these
applications, although not all of them.  That's because the "close document"
Apple event that HyperCard sends is not one of the events that applications are
required to support.  I don't know which of the 7.0-aware applications we're
hearing about now are able to understand this event, other than HyperCard 2.1
itself.

Finally, just as you can launch applications with the open command, you'll be
able to make them quit with the close command under 7.0.  For example:

   close "MacWrite Pro"

For those of you keeping score at home, HyperCard 2.1 is able to send any of
the four required Apple events to other applications.


 Apple event    What it means             How to send it from HC 2.1
 -----------    ---------------------     --------------------------
 'oapp'         You're newly launched     open "<application>"
 'odoc'         Open a document           open "<doc>" with "<app>"
 'pdoc'         Print a document          print "<doc>" with "<app>"
 'quit'         Quit                      close "<application>"


In addition, HyperCard 2.1 knows how to send a few of the core Apple events.


 'clos'         Close a document          close "<doc>" with "<app>"
 'dosc'         Execute a script          send <script> to program "<program>"
 'eval'         Evaluate an expression    request <expr> from program "<prog>"


In the case of the "do script" and "evaluate expression" events, you specify
the target program with a string of the form "Zone:Macintosh:Program".  For
example, you can make Claris Resolve execute a script contained in a card
field with the following command:

   send card field 1 to program "Other zone:other machine:Claris Resolve"


This is just a smattering of detail without the big picture.  I wish I had
time to write all of this up, including what you can do with HyperCard 2.1
when it's on the receiving end of an Apple event, but I'm a little busy this
week -- I'm preparing a demo for the big intro on Wednesday.  After that,
I'll post more information to the net.

Kevin Calhoun
jkc@apple.com

weiss@mott.seas.ucla.edu (Michael Weiss) (05/14/91)

In article <52835@apple.Apple.COM> jkc@Apple.COM (John Kevin Calhoun) writes:
> Apple event    What it means             How to send it from HC 2.1
> -----------    ---------------------     --------------------------
> 'oapp'         You're newly launched     open "<application>"
> 'odoc'         Open a document           open "<doc>" with "<app>"
> 'pdoc'         Print a document          print "<doc>" with "<app>"
> 'quit'         Quit                      close "<application>"
> 'clos'         Close a document          close "<doc>" with "<app>"
> 'dosc'         Execute a script          send <script> to program "<program>"
> 'eval'         Evaluate an expression    request <expr> from program "<prog>"

OK, here's a request.  Would it be possible (either through a HC update or
an XCMD) to send ANY AppleEvent?  In other words...let's say that there is
a published list of AppleEvents (which I assume there is, or will be), and
you want to send an AppleEvent to all open applications or to just one
particular application.  Would that be possible?  For example, could you 
perhaps have a command like:
   send 'oapp' to 'Microsoft Word'
so that MSWD would get the oapp AppleEvent?  I'm using oapp as an example,
but I'm talking more specifically about AppleEvents outside of the list
you gave.

Hope I didn't confuse you to death...
--
\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /
-  Michael Weiss  weiss@watson.seas.ucla.edu  |  School of Engineering and  -
-                 izzydp5@oac.ucla.edu        |    Applied Science, UCLA    -
/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | \