• 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: enumerated types: best way to fake them?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enumerated types: best way to fake them?


  • Subject: Re: enumerated types: best way to fake them?
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Fri, 01 Nov 2002 16:43:29 -0500

> Subject: enumerated types: best way to fake them?
> From: email@hidden (Michael Sullivan)
> Date: Fri, 1 Nov 2002 15:34:23 -0500

> My statement here assumes that there is not enumerated type support in
> AS, but I don't know that this is accurate. All I know is that searches
> on enum, enumerate, etc. in the ASLG failed, and I don't *know* how to
> do it already.

No, enumeration is almost totally in the domain of applications and
the language itself. If something isn't defined in AE resources, you
have very few options.

> What I'd like is the ability to have a variable that can take one of
> three values, and would be treated by AS in the same way that enumerated
> values of app objects are.

I often "borrow" enumerations that are already defined in Scripting
Additions or else where:

on DoSomething( yes_no_ask )

if ( yes_no_ask = yes ) then
...
else if ( yes_no_ask = no ) then
...
else if ( yes_no_ask = ask ) then
...

> Has anyone come up with a better idea for this sort of thing? Or do you
> just use integer flags or strings.

Right, nothing wrong with integer flags:

property apple : 0
property banana : 1
property orange : 2


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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.

  • Prev by Date: Re: enumerated types: best way to fake them?
  • Next by Date: Re: Busy Status
  • Previous by thread: Re: enumerated types: best way to fake them?
  • Next by thread: Re: enumerated types: best way to fake them?
  • Index(es):
    • Date
    • Thread