Re: add resource
Re: add resource
- Subject: Re: add resource
- From: John W Baxter <email@hidden>
- Date: Mon, 19 Aug 2002 18:37:27 -0700
At 15:07 -0700 8/19/2002, Matthew Galaher wrote:
>
I'm hoping that
>
I can find some example that I can edit so that I can add the ability to
>
choose creater and file type in a dialog.
The creator and type are not in the resource fork. And the add resource
scripting addition is not involved in setting the creator and type.
Speaking of the old way here:
Except in a file--typically an application (various hacks defined the
association elsewhere in the early days)--which defines the association
between a creator/type and an icon, and the application to open a file with
such a creator and type, the file's creator and type are not kept in the
file at all. They are kept in the "third part" of the file...the Finder's
information about the file.
So an old-style Mac file had three parts. The first two were tied together
in the file directory.
data fork
resource fork
Finder data (external to the file)
The resource fork is in a particular format, and the OS provides calls
which create it and set up the format in its empty state. But not all
files have an initialized resource fork even if they have never left the
Mac they were made on or been otherwise abused.
Just to make life more fun, AppleWorks (ClarisWorks before that) doesn't
really care about which file type is associated with a given AppleWorks
data file...you can set the file type to the spreadsheet's type and
AppleWorks nonetheless knows its a spreadsheet. AppleWorks had to work
cross-platform...its file layout included the file type with the first
several bytes of the file (along with the BOBO creator). That allowed the
to travel between Mac and Windows freely.
I carefully wrote three droplets to deal with the AppleWorks files I was
exchanging with Windows folks...when I realized that AppleWorks didn't
care, I stopped using all of them except for the word processor document
one.
There are many other formats which are fully identified by the "parent"
application using information in their data forks...all you need do is
induce the parent to open the file...drag and drop often works.
Here is the droplet I use for AppleWorks files in Mac OS 9.1 (it's so old
that is uses an old 4 byte code for file type...you could probably remove
the "obsolete" safely):
on open (theFiles)
if class of theFiles is not list then
set theFiles to {theFiles}
end if
tell application "Finder"
repeat with f in theFiles
set creator type of f to "BOBO"
set file type obsolete of f to "CWWP"
end repeat
end tell
end open
It worked last time I used it, which was before AppleScript 1.8.3.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.