• 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: Insert text into a document (beginners Question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insert text into a document (beginners Question)


  • Subject: Re: Insert text into a document (beginners Question)
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 12 Dec 2003 09:15:30 -0800

On 12/12/03 7:56 AM, "Robert Morse" <email@hidden> wrote:

> Another beginners question.
>
> Say I have a document loaded into TextEdit, and would like
> to insert some text at the current cursor position. How
> would I go about that.
>
> I have found a way to get all the text, found how to get
> the "selection point", but this gives me something like
> "Selection at character position 34 of file bla", which
> is really not what I think I need.
>
> If anyone can just do a small snippet on how to do it
> it would be great. I have the "Applescript in a nut
> shell" and got on order the other "O'Reilly" book, but
> that will take some time to arrive.

You can't possibly really mean TextEdit, can you? It doesn't have anything
to do with selection in its dictionary. Do you mean Tex-Edit Plus? Its terms
are exactly those you mention. If not, you should get Tex-Edit Plus
immediately. Its scriptability is a model of AppleScript implementation,
whereas TextEdit's scripting is junk. Which is unfortunate, since the app
itself is very good. Never mind. In Tex-Edit what you want is really simple
to do.


tell application "Tex-Edit Plus"
set selection to (return & return & "I'm now inserting a new paragraph
at this point." & return & return)
end tell



If you don't want it to be a new paragraph just leave out the 'returns':

tell application "Tex-Edit Plus"
set selection to "I'm now inserting a new sentence. "
end tell




--
Paul Berkowitz
_______________________________________________
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.

  • Follow-Ups:
    • Re: Insert text into a document (beginners Question)
      • From: Emmanuel <email@hidden>
References: 
 >Insert text into a document (beginners Question) (From: Robert Morse <email@hidden>)

  • Prev by Date: Re: Reading a file as it fills up by another program
  • Next by Date: Bizarre error message
  • Previous by thread: Insert text into a document (beginners Question)
  • Next by thread: Re: Insert text into a document (beginners Question)
  • Index(es):
    • Date
    • Thread