• 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: new line when writing to text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new line when writing to text file


  • Subject: Re: new line when writing to text file
  • From: Bruce Robertson <email@hidden>
  • Date: Tue, 23 Mar 2010 21:30:35 -0700

On Mar 23, 2010, at 8:28 PM, Jack Schwart wrote:

> Hi guys, anybody know what I'm doing wrong here...
>
> I am trying to input data into a text file, with each successive entry on a new line.
>
> I tried both...
>
> " \r " and
>
> " &return" to no avail.  Either it wouldn't compile or I got an error code for incompatible data type.
>
> Here's what I have so far...
>

Agreed with Tim that writing it all in one shot works and might be preferred. But if writing single lines then:

set pilotName to "Cap'n Bly"
set taxYear to 2009
set city to "Redmond"
set perdiemItem to "Nuts"
set amountForItem to 123.94

set PerDiemFile to (path to desktop folder as string) & "PerDiem.txt"
try
  close access file PerDiemFile
end try
set WorkingFile to open for access file PerDiemFile with write permission
set eof of WorkingFile to 0 -- Overwrites existing file to start from scratch
write pilotName & "'s Pilot Per Diem Logbook " & taxYear & return & return to WorkingFile
write (city as string) & return to WorkingFile
write (perdiemItem as string) & return to WorkingFile
write (amountForItem as string) & return to WorkingFile
close access file PerDiemFile

Bruce Robertson _______________________________________________
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

  • Follow-Ups:
    • Re: new line when writing to text file
      • From: Vittorio <email@hidden>
References: 
 >new line when writing to text file (From: Jack Schwart <email@hidden>)

  • Prev by Date: Re: new line when writing to text file
  • Next by Date: Re: quicktime player: make recording ... and save it
  • Previous by thread: Re: new line when writing to text file
  • Next by thread: Re: new line when writing to text file
  • Index(es):
    • Date
    • Thread