• 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
Enumerations in scriptSuite and scriptTerminology files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enumerations in scriptSuite and scriptTerminology files


  • Subject: Enumerations in scriptSuite and scriptTerminology files
  • From: Nicholas Shanks <email@hidden>
  • Date: Tue, 2 Mar 2004 12:19:18 +0000

I am trying to get an attribute to only accept certain strings (representing integers) as acceptable values, e.g.:

Class burger
Properties
meat ham/beef/turkey -- what the burger is made of

Allowing AppleScripts such as:
set meat of burger to beef

and to do this I would use (in the Burger.scriptSuite file):

<key>Classes</key>
<dict>
<key>Burger</key>
<dict>
<key>AppleEventCode</key>
<string>Burg</string>
<key>Attributes</key>
<dict>
<key>meat</key>
<dict>
<key>AppleEventCode</key>
<string>Meat</string>
<key>ReadOnly</key>
<string>NO</string>
<key>Type</key>
<string>NSNumber&lt;BurgerMeats&gt;</string>
</dict>
</dict>
</dict>
</dict>
<key>Enumerations</key>
<dict>
<key>BurgerMeats</key>
<dict>
<key>AppleEventCode</key>
<string>bMea</string>
<key>Enumerators</key>
<dict>
<key>BurgerMeatsBeef</key>
<string>mBef</string>
etc...
</dict>
</dict>
</dict>


and in the scriptTerminology file:

<key>Enumerations</key>
<dict>
<key>BurgerMeats</key>
<dict>
<key>BurgerMeatsBeef</key>
<dict>
<key>Description</key>
<string>mmm yummy</string>
<key>Name</key>
<string>beef</string>
</dict>
etc...
</dict>
</dict>


I modelled these on OmniWeb (5.0b2)
My three problems are thus:
Firstly, I seem to have no way of mapping the constants such as BurgerMeatsBeef (mBef) to an integer, e.g. 1. Does this have to be handled within the application?;
Secondly, "get meat of burger" would return " +constant ****; " instead of "beef" in the script editor (not even " +constant mBef; ", without the enumeration definitions it returns an int). If the value returned is 0, 1, or 2 it returns one of {stop, note, caution}. My feeling is that the problem lies with the type definition of the 'meat' attribute somehow (NSNumber<BurgerMeats>);
Third, "set meat of burger to beef" would consider beef to be a variable not a constant, and complain that is was undefined.

Can anyone help with these?

- Nick
_______________________________________________
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.


  • Prev by Date: Re: Split class implementation into separate files.
  • Next by Date: Re: Split class implementation into separate files.
  • Previous by thread: Re: Split class implementation into separate files.
  • Next by thread: Custom Properties in Address Book
  • Index(es):
    • Date
    • Thread