• 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: Checking a Record for a Field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

--
Best Regards,
Chris



 _______________________________________________
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

  • Follow-Ups:
    • Re: Checking a Record for a Field
      • From: Yvan KOENIG <email@hidden>
References: 
 >Checking a Record for a Field (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: Checking a Record for a Field
  • Next by Date: Re: Checking a Record for a Field
  • Previous by thread: Re: Checking a Record for a Field
  • Next by thread: Re: Checking a Record for a Field
  • Index(es):
    • Date
    • Thread