• 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: Adding to a text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding to a text file


  • Subject: Re: Adding to a text file
  • From: Dave Balderstone <email@hidden>
  • Date: Wed, 16 Mar 2005 13:48:12 -0600


On Mar 16, 2005, at 12:21 PM, Francois Houle wrote:

I'm just not sure how to do this, but is there a way with AS to add text
to the beginning of a .txt file ? I want to append two lines of text
which I as variables to make it easier to type ... Just dobnw know how
to append this text to the beginning of a file, and on two consecutive
lines.

Francois:

set theDesktop to path to desktop as string
set theFile to theDesktop & "A_text_file.txt" as string
set ReadFile to read file theFile
set theText to "This is line 1" & return & "this is line 2" & return as text
set WriteFile to theText & ReadFile
try
close access file ReadFile
end try
open for access file theFile with write permission
set eof file theFile to 0
write WriteFile to file theFile starting at eof
close access file theFile



_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Adding to a text file (From: "Francois Houle" <email@hidden>)

  • Prev by Date: RE: Adding to a text file
  • Next by Date: Re: Adding to a text file
  • Previous by thread: Re: Adding to a text file
  • Next by thread: RE: Adding to a text file
  • Index(es):
    • Date
    • Thread