I have a handler to which I would like to pass a variable number of arguments. I am using a record to pass the arguments and then checking in the handler whether or not a specific field exists so I can skip it if it doesn't. Here is how I am doing the check:
on myCoolHandler(someRecord) display dialog Field_1 of someRecord display dialog Field_2 of someRecord if checkForField_3(someRecord) then display dialog Field_3 of someRecord else display dialog "There ain't no Field 3" end if end myCoolHandler
on checkForField_3(theRecord) set returnValue to true try get Field_3 of theRecord on error set returnValue to false end try return returnValue end checkForField_3
set theRecord to {Field_1:"Field 1", Field_2:"Field 2"} myCoolHandler(theRecord)"
Is there an easier way to accomplish this? In particular, is there a way to parameterize the check? As it is, I need a separate "check handler" for each field I want to check.
Steve ------------------ OS X 10.6.8, AppleScript 2.1.2
|