• 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: Suppressing the error dialog box
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suppressing the error dialog box


  • Subject: Re: Suppressing the error dialog box
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 21 May 2010 09:53:29 +0200


Le 21 mai 2010 à 09:04, Tom Horton a écrit :

I'm need to detect an error in my AppleScript using on error, but I don't want to see the dialog box prompting me with OK or Cancel. I just need to know there was an error.
Is there an option to suppress the error dialog?


Thanks

One track may be :

try
the_instruction
on error errMsg number errNbr
set trapReport to "trap #xxx"&return &errMsg&"  number : "&errNbr
say trapReport
end try

An other one which I often use is

set report to ""

…
try
the_instruction
on error errMsg number errNbr
set trapReport to return &"trap #xxx"&return &errMsg&" number : "&errNbr
set report to report & trapReport
set the clipboard to report
end try
…


With that, even if the script fails, I'm able to grab the 'report' from the clipboard.

A third track would be to write trapReport in a text file.

Yvan KOENIG (VALLAURIS, France) vendredi 21 mai 2010 09:53:22



_______________________________________________
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
References: 
 >Suppressing the error dialog box (From: Tom Horton <email@hidden>)

  • Prev by Date: Suppressing the error dialog box
  • Next by Date: Re: Suppressing the error dialog box
  • Previous by thread: Suppressing the error dialog box
  • Next by thread: Re: Suppressing the error dialog box
  • Index(es):
    • Date
    • Thread