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

samples.basicStuff.iconCopier

«Gathers all the color icons on all disks in a file
«on your system disk named "Color Icons"
on resourceStealer (folder, restype, outputfile) «gather all icon resources in folder into outputfile
«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
local (ctcopied = 0) «the number of resources we've copied so far
if not file.exists (outputfile) «create the file since it doesn't exist
file.new (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)
name = file.fileFromPath (fname) + "." + serialnumber++
window.msg (name)
rez.putNamedResource (outputfile, restype, name, @data)
ctcopied++
if ctcopied > 0
msg (ctcopied + " '" + restype + "'s copied.")
launch.anything (outputfile) «open up the resource file we created
return (true)
resourceStealer ("", 'icl8', file.getSystemDisk () + "Color Icons")


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