• 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: AS ERROR...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AS ERROR...


  • Subject: Re: AS ERROR...
  • From: kai <email@hidden>
  • Date: Fri, 13 Apr 2007 00:40:13 +0100


On 13 Apr 2007, at 00:12, Don Wieland wrote:

I am trying to capture an ERROR when I run this script in FMP 8.5:

tell application "Printer Setup Utility"
try
set the current printer to printer "Officejet 6200 series"
on error errMsg number errNum
end try
quit
end tell

set field "gERROR" of table "Computers" to errMsg

When I MISPELL the printer name, the script run to completion and spits the
error in my FMP fields called "gERROR".


When I spell the printer name CORRECTLY, the script generates AS errors
saying the errMsg was not declared (also an error number). What do I need
to change to get it to run to completion in both scenarios?

The error handler is entered only when an error occurs within the try statement, Don. So if there's no error, the handler is skipped - and the variables errMsg and errNum are never defined.


One way around this would be to move the statement that sets the field in FMP to within the error handler.

However, to avoid including the statement in the 'tell application Printer Setup Utility' block, I'd suggest you try switching the nesting of the tell and try statements - something like this:

-----------
try
tell application "Printer Setup Utility"
set the current printer to printer "Officejet 6200 series"
end tell
on error errMsg
set field "gERROR" of table "Computers" to errMsg
end try
-----------

---
kai


_______________________________________________ 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: AS ERROR...
      • From: kai <email@hidden>
References: 
 >AS ERROR... (From: Don Wieland <email@hidden>)

  • Prev by Date: Re: AS ERROR...
  • Next by Date: Re: AS ERROR...
  • Previous by thread: AS ERROR...
  • Next by thread: Re: AS ERROR...
  • Index(es):
    • Date
    • Thread