HyperCard 2.0: Bypassing Dialog Boxes



When I use certain HyperCard 2.0 commands, either from the menu bar or from a
script, I get a dialog box that must be responded to. Examples:

command dialog box
--------------- -----------------------
Import Paint... Import Paint from...
Export Paint... Save Paint document as:

Is it possible to execute these commands from scripts, or from the message box,
without having to respond to the dialog boxes? And is it possible to open a
stack in new window from a HyperTalk script, also without dealing with a dialog
box?


Here are some commands that do what you want. In the examples, "stackname"
represents either a stack name, or the path to a given stack.

The first one imports a bitmap from the specified MacPaint file to the card
picture. It starts with the top-left corner of the MacPaint file, and clips to
HyperCard's current card size. It requires that one of HyperCard's paint tools
(such as the line tool) is first chosen.

choose line tool
import paint from file "stackname"


The next one creates a new MacPaint file, to which it exports the card image.
This is the equivalent of doing a screen dump from HyperCard, but you get to
choose the name of the output file in advance.

choose line tool
export paint to file "stackname"


Here's a command that opens a specified stack in a new window:

go "stackname" in new window


And one that creates a new stack and gives it a name:

create stack "stackname" <with backgroundname> <in new window>

The card size of the current stack becomes the card size of the new stack. If
no background is specified, the new stack is created with a blank background.
Otherwise, a copy of the specified background becomes the background of the new
stack. If "new window" is specified, the new stack is created in a new window
-- in other words, the old card window remains on-screen.


This one saves a copy of the specified stack under the new name you specify in
advance:

save stack "stackname1" as "stackname2"


Published Date: Feb 18, 2012