• 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: Dumb First Time Apple Scripting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dumb First Time Apple Scripting question


  • Subject: Re: Dumb First Time Apple Scripting question
  • From: Brian Webster <email@hidden>
  • Date: Wed, 3 Apr 2002 09:03:34 -0600

On Tuesday, April 2, 2002, at 07:33 PM, cocoa-dev-
email@hidden wrote:

The application compiles. ScriptEditor reads my dictionary just fine
(the app launches when this happens..) The dictionary in the
script editor shows this..

application shows
fooClass by numeric index, before/after another element, as a range
of elements, satisfying a test
Properties:
<Inheritance> application [r/o] -- All of the properties of the
superclass.

Here we see an interesting "feature" of the Cocoa scripting system. As far as I can tell, whenever you define an attribute that returns a non-basic object (i.e. not a string, number, etc.), Cocoa doesn't treat it as a property of its parent but rather as an element. So, while there is really only one fooClass object, Cocoa treats it as being multiple elements. Well, there aren't actually multiple objects (counting the fooClasses will return 1), but it lists them as though there could be.

tell application "AppleScriptTest"
tell fooClass
copy 5 to fooVar
end tell
end tell

So, because if this, you have to access the object as fooClass 1 rather than just plain fooClass. Also, you usually use a set command to set a property of an object. I think a copy might work correctly, but you should get used to using set. So, in short, try this script instead:

tell application "AppleScriptTest"
tell fooClass 1
set fooVar to 5
end tell
end tell

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Dumb First Time Apple Scripting question
      • From: Charles Bennett <email@hidden>
  • Prev by Date: [ANN] RRSpreadSheet control ALPHA release
  • Next by Date: [ANN] NibLocalizer
  • Previous by thread: [ANN] RRSpreadSheet control ALPHA release
  • Next by thread: Re: Dumb First Time Apple Scripting question
  • Index(es):
    • Date
    • Thread