[comp.sys.mac.hypercard] Exporting Card Pictures to files in HC

ollef@sics.se (Olle Furberg) (08/31/89)

I have a stack containing pictures of people, now I want to export these
pictures to MacPaint files. I could do this manually for every card, but I
want a script to do the work. Does anybody have any idea of how this should
be done?


    /Olle

ollef@sics.se (Olle Furberg) (08/31/89)

I have a stack containing pictures on every card, now I want to export these
pictures to MacPaint files. I could do this manually for every card, but I
want a script to do the work. Does anybody have any idea of how this should
be done?


    /Olle

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

In article <1989Aug31.110105.4531@sics.se> ollef@sics.se (Olle Furberg) writes:
>
>I have a stack containing pictures of people, now I want to export these
>pictures to MacPaint files. I could do this manually for every card, but I
>want a script to do the work. Does anybody have any idea of how this should
>be done?
>
    Yes, using MacroMaker.  First "start recording".  Copy the card
picture, pull out the scrapbook DA, paste, return to HyperCard,
end recording, store the macro with a unique name like "copy to scrap"
    Then you can copy a long sequence of card pictures with a script
roughly like:
    Choose select tool
    repeat forever
       domenu "copy to script"
       go next
    end repeat
But, if a dialog comes up, like "card does not have a picture, try
background", you are stalled.
    
Does anyone know how a script can tell if there is a card picture?

Dan Dlugose
UNC Educational Computing Service

ollef@sics.se (Olle Furberg) (09/07/89)

dlugose@ecsvax.uncecs.edu (Dan Dlugose) writes:

>In article <1989Aug31.110105.4531@sics.se> ollef@sics.se (Olle Furberg) writes:
>>
>>I have a stack containing pictures of people, now I want to export these
>>pictures to MacPaint files. I could do this manually for every card, but I
>>want a script to do the work. Does anybody have any idea of how this should
>>be done?
>>
>    Yes, using MacroMaker.  First "start recording".  Copy the card
>picture, pull out the scrapbook DA, paste, return to HyperCard,
>end recording, store the macro with a unique name like "copy to scrap"
>    Then you can copy a long sequence of card pictures with a script
>roughly like:
>

But this doesn't solve the main problem. I want a MacPaint-file for every card.

The main problem is that HC:s "Export Paint" is _interactive_: you get a
Save as... dialogbox.

I managed to solve the problem by using the following trick:

on exportpictures
  put StartUpVolume() into volume
  hide bg pict
  ---hide whatever you want: btns, flds etc
  set lockscreen to true
  set lockmessages to true
  repeat for the number of cds
     DoFKEY(3)
     set cursor to busy
     get renamefile(volume&":Screen 0", field name)
     if it is not "0" then
        answer "Error number "&&it&&"occured. Solve it!"
        exit repeat
     end if
     go next
  end repeat
  show bg pict
 -- show btns flds etc that was hidden in line 4 
end exportpicture


DoFKEY is an XFCN made by John Pugh (available from sumex?).
StartUpVolume() is a function waiting to be written. It could be replaced by
the name of your startupdisk but that's not the right way to do it.

RenameFile() could be find in Dev stack.

Field name is a bg field containing the name of the picture: no two field
should have the same content.

Unfourtanetly the Snapshoot is not always called "Screen 0": in the French 
System its name is "Ecran  0" (note the doublespace) and in Swedish "Sk{rm 0"
({=$8A). As a good HC-hacker you want to make your stack international: 
placing a copy of your FKEY 3 resource in the stack will do the job.


   /Olle

                                repeat fast for 5
                                  Have a Happy HyperCard HyperHacking!
                                end repeat