• 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
Setting TextEdit Insertion point
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting TextEdit Insertion point


  • Subject: Setting TextEdit Insertion point
  • From: "Ken G. Brown" <email@hidden>
  • Date: Fri, 13 Jul 2007 21:22:58 -0600

I'm trying to use Applescript to tell TextEdit to open a file, and insert a date/time stamp at the beginning of the file in front of the previous text, followed by two blank lines, then put the insertion point at the beginning of the first blank line so the user can add text at the beginning of a file followed by a blank line. The insertion point always ends up at the end of the file.

This almost does what I want but I do not know how to position the insertion point to where I need it.

set myFile to "MacHD:Testfile.txt"
tell application "TextEdit"
	activate
	open (file named myFile)
	set myTimeStamp to current date
	tell document 1
		set text 1 to (("-- " & myTimeStamp as string) & " --" & return & return & return) & (text 1)
	end tell
end tell

Any tips appreciated...
Thx
Ken
 _______________________________________________
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: Setting TextEdit Insertion point
      • From: Bill Briggs <email@hidden>
  • Prev by Date: Re: Persistent data storage
  • Next by Date: Re: Setting TextEdit Insertion point
  • Previous by thread: Re: create new field definitons in FileMaker
  • Next by thread: Re: Setting TextEdit Insertion point
  • Index(es):
    • Date
    • Thread