• 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: Error trap if item cannot be made into an integer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error trap if item cannot be made into an integer?


  • Subject: Re: Error trap if item cannot be made into an integer?
  • From: Paul Berkowitz <email@hidden>
  • Date: Mon, 18 Nov 2002 19:53:23 -0800

On 11/18/02 3:12 PM, "Kenton Muschenheim" <email@hidden>
wrote:

> I'm looping through items in a list and I want to skip the item if the item
> name can't be made into an integer. What's the syntax to trap the "Can't
> make into an integer" error?

try
set theItem to theItem as integer
--do other stuff if it coerces
end try

There are ways of "skipping" the rest of the repeat loop if you're wary of
including the whole of 'other stuff' in the try block, and using the 'try/on
error' just for the the first line, wit the 'skip' in the 'on error'.


--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Error trap if item cannot be made into an integer? (From: Kenton Muschenheim <email@hidden>)

  • Prev by Date: Re: Launch Default Mail App attached the file
  • Next by Date: Re: Error trap if item cannot be made into an integer?
  • Previous by thread: Error trap if item cannot be made into an integer?
  • Next by thread: Re: Error trap if item cannot be made into an integer?
  • Index(es):
    • Date
    • Thread