• 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: Ken Dobson <email@hidden>
  • Date: Tue, 13 Feb 2001 22:13:48 -0500

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



This works for the current problem (can be found in the AS Guidebook)

--
set aMth to "Sept"
set theMths to {"Jan", "Feb", "March", "Apr", "May", "June", "July", "Aug",
"Sept", "Oct", "Nov", "Dec"}
set mthNum to list_position(aMth, theMths)
--> 9
--
on list_position(x, this_list)
repeat with i from 1 to (count of this_list)
if item i of this_list is x then return i
end repeat
end list_position


  • Prev by Date: simple math expressions
  • Next by Date: Automating QuickTimePlayer with Applescripts
  • Previous by thread: Re: Accessing a Record by variable
  • Next by thread: Re: Accessing a Record by variable
  • Index(es):
    • Date
    • Thread