Re: Insert text into a document (beginners Question)
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 13:59:27 -0800
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.
>
>
Xcode's dictionary was evidently created by real, proper AppleScript team -
>
probably _the_ AppleScript team. It shares a lot with the As Studio
>
dictionary too. What a pleasure to see.
I'd guess we owe a lot to Tim Bumgarner for this implementation. That's
promising for getting bugs like 'character range' fixed. I'll go file the
bug now.
--
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.