• 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: Remove Final C/R?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Remove Final C/R?
  • Next by Date: Re: sending data from one AppleScript App to another
  • Previous by thread: Re: Remove Final C/R?
  • Next by thread: Re: sending data from one AppleScript App to another
  • Index(es):
    • Date
    • Thread