• 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: interesting discovery (trying to get record labels as strings )
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interesting discovery (trying to get record labels as strings )


  • Subject: Re: interesting discovery (trying to get record labels as strings )
  • From: Olof Hellman <email@hidden>
  • Date: Mon, 3 Dec 2001 17:15:11 -0800

Victor wrote :

> The problem with records (as others have pointed out) is that
> calling the keys
> has to be hardwired into the code. The AppleScript team is
> apparently working on
> it, but that probably wouldn't be available for anything less
> than MacOS X.
>


Actually no, it doesn't need to be hardwired. That's why I posted my
extract_exact_usrf handler a few days ago:

Note that extract_exact_usrf takes a variable as the key:


to extract_exact_usrf(theRecord, fieldName)
script Fred
property r : theRecord
to extract()
end extract
end script

set Amy to run script "script George
property r : {}
to extract()
return |" & fieldName & "| of r -- note the bars!!
end extract
end
George"

set Fred's extract to Amy's extract
return (Fred's extract())
end extract_exact_usrf

to usrf(theList)
script
{+class usrf;:theList}
end script
run script the result
end usrf

set usrfRecord to usrf({"EU", 3, "b", 2})
-->{|EU|:3, b:2}

-- now use the string "EU" to get record item |EU|
extract_exact_usrf(usrfRecord, "EU")
--> 3


- Olof


  • Prev by Date: Re: interesting discovery (trying to get record labels as strings)
  • Next by Date: Re: interesting discovery (trying to get record labels as strings)
  • Previous by thread: Re: Path to app ...
  • Next by thread: Re: interesting discovery (trying to get record labels as strings )
  • Index(es):
    • Date
    • Thread