• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reading resource forks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading resource forks


  • Subject: Re: Reading resource forks
  • From: Christopher Nebel <email@hidden>
  • Date: Sat, 6 Dec 2003 00:12:28 -0800

This will work -- at least, the POSIX-style version does in the shell, I've never tried the HFS version -- but realize that you'll be getting the raw bytes of the entire resource fork, which you'll then have to interpret yourself, including figuring out where the FOND resource begins and ends. This will be non-trivial.

--Chris Nebel
AppleScript Engineering

On Dec 5, 2003, at 3:52 PM, Graff wrote:

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.

  • Follow-Ups:
    • Reading a file as it fills up by another program
      • From: email@hidden
    • Re: Reading resource forks
      • From: Graff <email@hidden>
    • Re: Reading resource forks
      • From: Walter Ian Kaye <email@hidden>
    • do shell script, redirected piped and backgrounded
      • From: Harald E Brandt <email@hidden>
References: 
 >Reading resource forks (From: Graff <email@hidden>)

  • Prev by Date: Re: It can not be only me...
  • Next by Date: RE: Reading resource forks
  • Previous by thread: Reading resource forks
  • Next by thread: do shell script, redirected piped and backgrounded
  • Index(es):
    • Date
    • Thread