• 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: Walter Ian Kaye <email@hidden>
  • Date: Fri, 12 Dec 2003 14:22:35 -0800

At 01:59p -0800 12/12/2003, Paul Berkowitz didst inscribe upon an electronic papyrus:

On 12/12/03 1:04 PM, "Paul Berkowitz" <email@hidden> wrote:

> I'd have to figure out how to reset the selection to just the end of the
> first inserted sentence (i.e. collapse the selection) if I wanted to insert
> a second sentence _after_ the first one. I'm sure that's possible.

This is what should work:

tell application "Xcode"
tell text document 1
set theSelection to selection
set {a, b} to character range of theSelection
set character range of theSelection to {b, b}
set contents of theSelection to "Insert another sentence here. "
end tell
end tell

But it errors on getting the 'character range'. That appears to be a bug,
especially since the result of 'selection' is:

--> characters 19 thru 42 of document "Untitled" of application "Xcode"

If anyone knows another way parse that '19' and '42', it should be possible
to set insertion point of the text, if not character range.

Can you use 'after' and/or 'end of' selection?


-boo
pantherless
_______________________________________________
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>
References: 
 >Re: Insert text into a document (beginners Question) (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Insert text into a document (beginners Question) Solved
  • Next by Date: New AppleScript book
  • 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