Re: [OT] UNIX heads; can I do this?
Re: [OT] UNIX heads; can I do this?
- Subject: Re: [OT] UNIX heads; can I do this?
- From: Marc Myers <email@hidden>
- Date: Thu, 14 Jun 2007 00:41:22 -0400
I'm not really up on all of this shell scripting stuff, but it's pretty
simple in Vanilla AppleScript:
set cr to ASCII character 13
set lf to ASCII character 10
set theFile to (choose file of type "TEXT") as text
try
set fileRef to (open for access file theFile)
set theText to read fileRef
close access fileRef
on error errMsg number errNbr
try
close access fileRef
end try
error errMsg number errNbr
end try
set {od, AppleScript's text item delimiters} to ¬
{AppleScript's text item delimiters, cr}
set theText to text items of theText
set AppleScript's text item delimiters to lf
set theText to theText as text
set AppleScript's text item delimiters to od
try
set fileRef to open for access file theFile ¬
with write permission
set eof fileRef to 0
write theText to fileRef starting at eof
close access fileRef
on error errMsg number errNbr
try
close access fileRef
end try
error errMsg number errNbr
end try
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden