Part of the Samples Website. 8/16/97.


«Gathers all the resource of the indicated type into a file that you can edit with ResEdit
«if the output file doesn't exist, we create it so it can be opened with ResEdit
«then we travel through all the files in the folder, at all levels
«copying all the resources into the output file
«this script is built to be called from other scripts
«or from the QuickScript window
«or as a one-liner in an outline
on resourceStealer (folder, restype, outputfile) «gather all icon resources in folder into outputfile
local (ctstolen = 0) «the number of resources we've stolen so far
if not file.exists (outputfile) «create the file since it doesn't exist (outputfile)
file.setType (outputfile, 'rsrc')
file.setCreator (outputfile, 'RSED')
local (fname)
fileloop (fname in folder, infinity)
rollBeachBall ()
if not file.isBusy (fname) «can't get inside of busy files
local (ct = rez.countresources (fname, restype))
if ct > 0
local (serialnumber = 1)
local (n, name)
local (data) «holds the resource data
loop (n = 1; n <= ct; n++)
rollBeachBall ()
if rez.getnthresource (fname, restype, n, @name, @data)
if name == ""
name = file.fileFromPath (fname) + "." + serialnumber++
rez.putnamedresource (outputfile, restype, name, @data)
if ctstolen > 0
msg (ctstolen + " '" + restype + "'s copied.")
launch.anything (outputfile) «open up the resource file we created
return (true)

This page was last built on Sat, Aug 16, 1997 at 6:40:09 PM. You can download the current set of sample scripts from our FTP site. Dave