• 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: Graff <email@hidden>
  • Date: Fri, 05 Dec 2003 20:59:43 -0500

I was fooling around a bit more and I found out that trying the same process on the data fork resulted in the exact same file as with the resource fork. I tried doing it with a shell script and it worked fine, so here's an example with a shell script:

Keep in mind that the option-return character used for line continuation in Script Editor gets converted to a comma or something else by this mailing list. There should be one of them at the end of each of the lines 6, 10, 17, and 21.
---------
set posixPathToFile to "/Users/username/Desktop/Test"
set saveLocation to ((path to desktop) as text)
try
set writeIsOpen to false

set theResource to do shell script "cat " & ,
posixPathToFile & "/..namedfork/rsrc"
display dialog "rsrc read"

set theWriteFile to open for access saveLocation & ,
"SystemRSRC.txt" with write permission
set writeIsOpen to true
write theResource to theWriteFile
close access theWriteFile
set writeIsOpen to false

set theData to do shell script "cat " & ,
posixPathToFile & "/..namedfork/data"
display dialog "data read"

set theWriteFile to open for access saveLocation & ,
"SystemData.txt" with write permission
set writeIsOpen to true
write theData to theWriteFile
close access theWriteFile
set writeIsOpen to false
on error
display dialog "Didn't work"
if writeIsOpen then close access theWriteFile
end try
---------

- Ken

On Dec 5, 2003, at 7:55 PM, 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.
_______________________________________________
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.

  • Prev by Date: RE: Reading resource forks
  • Next by Date: Re: Script server as faceless background application?
  • Previous by thread: RE: Reading resource forks
  • Next by thread: RE: Reading resource forks
  • Index(es):
    • Date
    • Thread