[comp.sys.mac.hypercard] Print Report for selected cards

willcox@urbana.mcd.mot.com (David A Willcox) (08/28/89)

I am just starting out in the world of HyperCard authoring.  As my first
exercise (a learning experience) I am playing with a "name, address, and
interests" stack, a modification of one of the samples that comes with
HyperCard. 

Things are mostly pretty straightforward, but there is one thing that
I haven't figured out how to do.  I would like to be able to print a
report for selected cards; for example all cards that contain
"windsurfing" as an interest.  I know how to use

	open printing [with dialog]
	print <whichever card(s)>
	close printing

but that prints out images of cards, which isn't what I want.  I want
to print in the format produced by "Print Report", but only for selected
cards.

I suppose my script could create a new stack with only the desired
cards, and then "Print Report" from there, but that seems like a
sledge-hammer appproach.  I keep thinking I must be missing something
obvious.

Any suggestions or pointers would be appreciated.  If people mail
directly to me rather than posting, I would be happy to summarize. 

--
David A. Willcox
Motorola, Urbana Design Center	UUCP: ...!uiucuxc!udc!willcox
1101 E. University Ave.		INET: willcox@urbana.mcd.mot.com
Urbana, IL 61801		FONE: 217-384-8534

fwb@demon.siemens.com (Frederic W. Brehm) (08/30/89)

willcox@urbana.mcd.mot.com (David A Willcox) writes:
>Things are mostly pretty straightforward, but there is one thing that
>I haven't figured out how to do.  I would like to be able to print a
>report for selected cards; for example all cards that contain
>"windsurfing" as an interest.

Here is an outline of what to do (details are left as an exercise for the
reader :-)

1) Generate a file name and put it into a global variable file_name.  I
    have found that it should have a full path name (printing with an
    application does not seem to work properly otherwise).

2) Execute the command

    open file file_name

3) Search for your selection criteria.  When you have it, do

    on haveCardToPrint
	global file_name
	write return & field "Name and Address" & return to file file_name
	-- or whatever you want to write
    end someEvent

4) When you are all done, then

    on printReport
	global file_name
	close file file_name
	answer "Print " & quote & file_name & quote & "?" \
	    with "Cancel" or "Edit" or "Print"
	if it is "Print" then
	    print file_name with "TeachText"
	else if it is "Edit" then
	    open file_name with "TeachText"
	end if
    end printList

I hope this helps.
Fred
--
Frederic W. Brehm	Siemens Corporate Research	Princeton, NJ
fwb@demon.siemens.com	-or-	princeton!siemens!demon!fwb

dlugose@ecsvax.uncecs.edu (Dan Dlugose) (09/01/89)

In article <980@urbana.mcd.mot.com> willcox@urbana.mcd.mot.com (David A Willcox) writes:
>I haven't figured out how to do.  I would like to be able to print a
>report for selected cards; for example all cards that contain
>"windsurfing" as an interest.  I know how to use

   When I want to print information from selected cards, I take ad
of the fact that "print report" skips cards if fields are chosen that 
are blank.  I have a script find all the cards that fit my criteria
and put the info I want into a field which would otherwise be blank.

Dan Dlugose
UNC Educational Computing Service