Re: Checking a Record for a Field
Re: Checking a Record for a Field
- Subject: Re: Checking a Record for a Field
- From: Christopher Stone <email@hidden>
- Date: Mon, 16 Nov 2015 11:21:10 -0600
On Nov 16, 2015, at 08:17, S. J. Cunningham <email@hidden> wrote:
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. ______________________________________________________________________
Hey Steve,
The hackish way to handle that:
set theRecord to {Field_1:"Field 1", Field_2:"Field 2"}
try theRecord / 0 on error eMsg set AppleScript's text item delimiters to {"{", "}"} set checkRecord to text item 2 of eMsg end try
set AppleScript's text item delimiters to ":"
set fieldName to text item 1 of checkRecord set s to fieldName & " of {" & checkRecord & "}" run script s
I believe there's an ASObjC method to extract the keys directly.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden