RE: Reading resource forks
RE: Reading resource forks
- Subject: RE: Reading resource forks
- From: Emmanuel <email@hidden>
- Date: Sat, 6 Dec 2003 13:08:15 +0100
Maybe I am missing something, but maybe you can use the Satimage osax' commands? They include: "list resources" (retrieves all the ids for a particular type such as "FOND"), "load resource" (get the resource) and "put resource (write).
I think you may need Smile's "display" commands, too, to make the result into a string, but I'm not sure.
Emmanuel
At 4:55 PM -0800 05/12/03, Will Parker wrote:
>
Thanks! I'll give that a try.
>
>
-Will
>
--------------------
>
Will Parker
>
email@hidden
>
>
Macintosh Business Unit
>
>
>
-----Original Message-----
>
From: Graff [mailto:email@hidden]
>
Sent: Friday, December 05, 2003 3:52 PM
>
To: Will Parker
>
Cc: AppleScript-Users listat apple.com
>
Subject: Reading resource forks
>
>
Well technically under HFS+ you can access a resource fork for a file
>
with the name "filename" by using:
>
filename/..namedfork/rsrc
>
the data fork would be at:
>
filename/..namedfork/data
>
>
I believe can also use the classic "Finder" path format:
>
filename:..namedfork:rsrc
>
>
So I suppose that you could try opening the resource fork as a normal
>
file with read-only access. It *should* work just fine.
>
>
I wrote a little script to test it and it seems to work - here it is:
>
------
>
try
>
set didOpenRead to false
>
set didOpenWrite to false
>
>
set theReadFile to open for access ((path to desktop) as text) &
>
"Test:..namedfork:rsrc"
>
set didOpenRead to true
>
set theResources to read theReadFile
>
close access theReadFile
>
>
set theWriteFile to open for access ((path to desktop) as text)
>
& "TestRSRC.txt" with write permission
>
set didOpenWrite to true
>
write theResources to theWriteFile
>
close access theWriteFile
>
on error
>
display dialog "Didn't work"
>
if didOpenRead then close access theReadFile
>
if didOpenWrite then close access theWriteFile end try
>
------
>
>
On Dec 5, 2003, at 5:01 PM, Will Parker wrote:
>
>
> Now then - can someone give me an idea of how to open file resources
>
> read-only? I need to grab some esoteric font information from the
>
> 'FOND'
>
> resource of font files, and I'd like to do it entirely in AppleScript
>
> by parsing out the file.
>
_______________________________________________
>
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.
_______________________________________________
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.