• 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
OS-9 question on try with on error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OS-9 question on try with on error


  • Subject: OS-9 question on try with on error
  • From: Doug McNutt <email@hidden>
  • Date: Mon, 7 Jun 2010 16:24:32 -0600

While playing around with Excel, on this OS 9 I 8500, I came across some older code that I thought I could simplify.  It's also perhaps germane to a previous posting by L R K Perera.

What I want is a try - end try block that includes an on error section that will simply quit running the rest of the script in the event of an error. The old code looks like this: (Yes it's an Applescript if you look closely. MPW is one of the best things Apple ever did.)

Begin
  Echo  'tell application "Microsoft Excel"'
  Echo  'activate'
  Echo  'try'
  Echo  'set err to true'
  Echo  'Select Sheet "Worth"'  # Check to see if a special workbook is open in Excel
  Echo  'on error'
  Echo  'set err to false'
  Echo  'end try'
  Echo  'if err then'
  Echo  'Evaluate "Finance_10.xls!TickerPickUp()"'  # Run my Excel VBA macro
  Echo  'end if'
  Echo  'end tell'
End | RunApplescript >> Dev:Null

Is there a simpler way to just exit if an error occurs? "exit" is for repeat loops only.

--

--> A fair tax is one that you pay but I don't <--
 _______________________________________________
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: OS-9 question on try with on error
      • From: Luther Fuller <email@hidden>
  • Prev by Date: Re: Run a macro in Excel 2004
  • Next by Date: code runs in script editor, hangs as an FBA
  • Previous by thread: Re: Run a macro in Excel 2004
  • Next by thread: Re: OS-9 question on try with on error
  • Index(es):
    • Date
    • Thread