• 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: Robert Morse <email@hidden>
  • Date: Fri, 12 Dec 2003 14:54:14 -0500

Well, Actually I am trying to insert into XCode text document. I thought that
TextEdit and Xcode would have about the same way to input
data into the document. But, I am still not able to input
anything.

I tried :

tell application "Xcode"
activate
set doc to text document 1
tell doc
set selection to (return & "Hello" & return)
end tell
end tell

but it does not seem to work.

The XCode dictionary has a "selection selection-object" as a property of its
text document class.

Robert


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: Paul Berkowitz <email@hidden>
  • Prev by Date: AS Studio tab views...
  • Next by Date: Re: Finder Zip scriptable
  • Previous by thread: Re: Insert text into a document (beginners Question)
  • Next by thread: Re: Insert text into a document (beginners Question)
  • Index(es):
    • Date
    • Thread