Extracting Resources from MacOS X Resource Files
Richard Gaskin
ambassador at fourthworld.com
Wed Jan 21 11:09:02 EST 2009
Dave wrote:
> I tried the getResource command in revolution, it doesn't seem to
> work with Mac OS X .rsrc files. For instance when I run this script
> from a button:
>
> on mouseUp
> local myFilePathName
> local myResourceData
> local myResult
>
> put "/Users/Dave/Desktop/iTunesImages/myFile.rsrc" into
> myFilePathName
>
> put getResources(myFilePathName) into myResourceData
> put the result into myResult
>
> end mouseUp
>
> myResourceData and myResult are both empty, yet when I look at the
> file with ThemePark it show the Icons and Files ok. The myFile.rsrc I
> used here was taken from iTunes in the Resources folder inside the
> App Package.
>
> What I really want is to convert the pngs and icns into JPEG images.
The getResources function works on the resource fork only, added back in
the OS 8.5 days and increasingly Apple is migrating away from using
resource forks so it's not so useful under OS X.*
So while that explains why you're not getting what you're looking for
with that, I'm confused about what's in iTunes .rsrc file. It seems its
icons are stored in several dozen .icns files within the bundle's
"Resources" folder. With a tool or external that can extract the image
data from them (could conceivably be done with a script too) it would
seem those icns files are where you would obtain those images.
Yet the iTunes .rsrc file weighs in at more than 10MB. What's in it?
* I'll take this opportunity to make another prediction about Apple:
one of the next major changes to the OS seems likely to be migrating
away from HSF to the same file system used by Unix/Linux. The downside
to this migration is the final end of the old resource forks, but the
upside would be complete compatibility with most of the non-Microsoft
world while further marginalizing Windows, drawing attention to it being
a technological island.
Similar in scope to the other major transitions (68k->PPC, Classic->OS
X, PPC->Intel) this will be somewhat disruptive during the transitional
phase, but will also carry an upside for vendors as the previous
transitions did by artificially enhancing demand for software upgrades
which would otherwise be dependent on features alone.
I'll go further out on a limb to predict this will be announced within
the next three years.
--
Richard Gaskin
Fourth World
Revolution training and consulting: http://www.fourthworld.com
Webzine for Rev developers: http://www.revjournal.com
More information about the use-livecode
mailing list