Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!gem.mps.ohio-state.edu!apple!excelan!unix!stores From: stores@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac.programmer Subject: Re: Scrapbook File format Message-ID: <4550@unix.SRI.COM> Date: 12 Oct 89 16:35:17 GMT References: <785@cogsci.ucsd.EDU> Reply-To: stores@unix.UUCP (Matt Mora) Organization: SRI International, Menlo Park, CA Lines: 50 In article <785@cogsci.ucsd.EDU> carrier@cogsci.ucsd.edu (Mark Carrier) writes: > >Does anybody have or know where to find the format of the Scrapbook >File? The reason I ask is that I would like to be able to take a set >of many PICT resources (cut from various graphics applications) and >one-by-one convert them to a format suitable for use on a PC. I've >already got the conversion code working properly, but I now have the >problem of having to apply my Mac code to each image individually, >invoking my application each time. If I knew the format of the scrapbook >file (all the images are contained in scrapbook files) then I could >just start the whole process off and leave it to do each conversion >automatically. >Thanks in advance. >Mark Carrier >carrier@cogsci.ucsd.edu I don't realy know the format of the scrapbook file, but if its just PICT's that you want, that's easy. If look at the scrapbook file with resedit you see that it has a bunch of resources, PICT being one of them. If you open the PICT resource you can see a list of them. To get these out without knowing there Id numbers, you can use the rom call Get1IndResource (GetIndResource if you have 64K roms). This will give you a handle to the e PICTs. Count1Resources will return the number of the resource type that you specified. Loop and call Get1IndResource each time through the loop to get a handle to the next pict in the file. Below is some Ugly pseudo pseudocode. ref:=OpenResFile('scrapbook'); {open scrapbookfile} index:=Count1Resources('PICT'); {find out how many there are} for i=1 to index do begin myPicthandle:=Get1IndResource(rType, index); {get the next PICT} {do your conversion} DisposHandle(myPicthandle); end; CloseResFile(ref); end. -- ___________________________________________________________ Matthew Mora SRI International stores@unix.sri.com ___________________________________________________________