• 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: Accessing a Record by variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing a Record by variable


  • Subject: Re: Accessing a Record by variable
  • From: "Arthur J Knapp" <email@hidden>
  • Date: Tue, 13 Feb 2001 17:42:26 -0500

> Date: Tue, 13 Feb 2001 13:34:06 EST
> Subject: Re: Accessing a Record by variable

>>on 2/12/01 8:02 PM, Douglas Wagner at email@hidden wrote:

>>> set aMth to "Feb"
>>> set theMths to {Jan:"1", Feb:"2", Mar:"3", Apr:"4", May:"5", Jun:"6",
...
>>> set mthNum to aMth in theMths

>>> what I'd like to get is --> 2

>>> I'm astonished this doesn't work.

Astonished!

Well, I'm afraid there may be all sorts of astonishing
disappoints in your future regarding AppleScript. ;-)


>>> Is there an elegant alternative?

This should do for this specific purpose:


property kStrMonths : "JanFebMarAprMayJunJulAugSepOctNovDec"

on monthIndex(mon)

-- Note, mon must be case-sensitive

set x to offset of mon in kStrMonths

if (x = 0) then

return 0 -- or cause error
else
return x div 3 + 1

end if
end monthIndex

monthIndex("Feb") -- > 2


--
{
Arthur J Knapp, of STELLARViSIONs ;

http://www.STELLARViSIONs.com ;

mailto:email@hidden ;

"...it's not my birthday,
it's not today..."
}


  • Prev by Date: Re: Need to search a folder and sub folders for files
  • Next by Date: Re: Accessing a Record by variable
  • Previous by thread: Re: accessing a record by variable
  • Next by thread: Re: Accessing a Record by variable
  • Index(es):
    • Date
    • Thread