Re: Remove Final C/R?
Re: Remove Final C/R?
- Subject: Re: Remove Final C/R?
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 1 Sep 2003 16:20:54 -0400
Date: Mon, 1 Sep 2003 11:48:46 -0700
To: email@hidden
From: Marconi <email@hidden>
Subject: Remove Final C/R?
Given the full path to a text file, I need to simply remove the new
line after the last line, i.e., the carriage return at the very end
of the file. I can't figure out how...
Try this:
set theFile to choose file of type "TEXT"
set fileID to (open for access theFile with write permission)
try
set theText to (read fileID)
set theText to text 1 thru -2 of theText
set eof fileID to 0
write theText to fileID
close access fileID
on error errMsg
close access fileID
error errMsg
end try
Marc [09/01/03 4:20:35 PM]
_______________________________________________
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.