• 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: How to add "\n" to text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add "\n" to text?


  • Subject: Re: How to add "\n" to text?
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 2 Oct 2001 09:56:36 -0700

On Monday, October 1, 2001, at 08:48 PM, Jaime Magiera wrote:

I'm trying to create a text file that's UNIX friendly and can't figure out how to get a new line "\n" written to the text file from the script.

As a couple people said, "ASCII character 10" is the works-anywhere solution. As of version 1.7, AppleScript supports "\n" in strings directly, just like "\r", so you could do something like this:

write "This is\r a Mac line ending" to mac_file
write "This is\n a Unix line ending" to unix_file

Scripts compiled using "\n" will work correctly with older versions of AppleScript, though the \n won't be visible when you view the source.


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • Re: How to add "\n" to text?
      • From: Jaime Magiera <email@hidden>
References: 
 >How to add "\n" to text? (From: Jaime Magiera <email@hidden>)

  • Prev by Date: Re: Chainmail Applescript
  • Next by Date: Re: Is there a "wake up" detector?
  • Previous by thread: Re: How to add "\n" to text?
  • Next by thread: Re: How to add "\n" to text?
  • Index(es):
    • Date
    • Thread