• 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 the selection of a document via AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the selection of a document via AppleScript


  • Subject: Setting the selection of a document via AppleScript
  • From: "Timothy J. Wood" <email@hidden>
  • Date: Wed, 15 Jun 2005 20:49:07 -0700



I'm working on updating OmniObjectMeter to work with Xcode 2.1. One of the things we need to be able to do is to open a file and select a particular _line_ (i.e., I don't know the character range off hand).

Rather than take the old approach of having a bundle that gets loaded into Xcode and that uses shady API, I'd rather use AppleScript to do the work. I'm not sure if this is possible though. I can do:

tell application "Xcode"
    open file "Extra:private:tmp:foo.m"
    set MyDoc to text document "foo.m"
    selection of MyDoc
end tell

-->       text 5 thru 8 of text document "foo.m"

If I then try to evaluate the expression 'text 5 thru 8 of text document "foo.m"', I get an error.

If I try 'select text 5 thru 8 of text document "foo.m"', I get an error. All the other variants I have tried give pretty much useless errors (par for the course with AppleScript).

  What I'd like to do is:

        select line 1 of text document "foo.m"

  Naturally, that leads to another error :)

Also acceptable would be a URL form that specified the path and line or character range to select :)

  Any hints?

-tim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting the selection of a document via AppleScript
      • From: Scott Tooker <email@hidden>
  • Prev by Date: Re: -fast creates linker error
  • Next by Date: Re: Using libexpat from the system
  • Previous by thread: Re: SCM Error: SCM could not go online
  • Next by thread: Re: Setting the selection of a document via AppleScript
  • Index(es):
    • Date
    • Thread