Aaron, I did not see the error when I ran this using the WSH under vista; or maybe I used CScript, but for some reason he and I aren't seeing the error dialog.
when I go home tonight, I'll experiement more to see why that was. Chip ------------------------------ Chip Orange Database Administrator Florida Public Service Commission chip.ora...@psc.state.fl.us (850) 413-6314 (Any opinions expressed are solely those of the author and do not necessarily reflect those of the Florida Public Service Commission.) > -----Original Message----- > From: Aaron Smith [mailto:aa...@gwmicro.com] > Sent: Thursday, August 20, 2009 5:00 PM > To: gw-scripting@gwmicro.com > Subject: Re: a "standard" VBScript feature won't work in WE > > As Ron pointed out, Window-Eyes OnError gives you the best of all > possible worlds. Although Mr. Harvey's example works, the end > user still > sees the error before any error handling really takes place. > Use Ron's > example, and you'll see the difference Window-Eyes can make > when you're > trying to handle script errors.. > > Aaron > > On 8/20/2009 4:49 PM, Ron Parker wrote: > > Chip Orange wrote: > >> I can't do it in a WE script however; it simply halts on the line > >> having the error. I'm not using GWToolkit error handling > in any way. > > > > That code was very weirdly formatted. Either whoever wrote > it was trying > > to make what he was doing look more mysterious, or he was > just on crack. > > > > The difference between WSH and Window-Eyes is that for > whatever reason, > > WSH apparently doesn't try to handle that error by popping > up a dialog > > box. We do. However, you can override that behavior for > your script by > > offering to handle the OnError event yourself. Obviously, if you do > > that, you should be prepared to deal with errors that occur > outside of > > your pseudo-try block, perhaps by deferring to the toolkit error > > handling in those cases. In my test, I just handled all errors by > > ignoring them completely. If you do this, though, note that we will > > still know the error happened, and we'll set your status to "Running > > with Errors" in the script manager. > > > > Anyway, this code seems to do more or less what you expect with > > Window-Eyes: > > > > ' ======8<--- cut here --------- > > > > Class CFunc1 > > Private Sub Class_Initialize > > DoLog "Starting" > > Dim i : i = 65535 ^ 65535 > > MsgBox "Should not see this" > > End Sub > > Private Sub CatchErr > > If Err.Number = 0 Then Exit Sub > > Select Case Err.Number > > Case 6 DoLog "Overflow handled!" > > Case Else DoLog "Unhandled error " & Err.Number & " occurred." > > End Select > > Err.Clear > > End Sub > > Private Sub Class_Terminate > > CatchErr > > DoLog "Exiting" > > End Sub > > Private Sub DoLog( a ) > > MsgBox a > > End Sub > > End Class > > > > Sub OnError( path, name, desc, source, wcode, scode, line, column ) > > End Sub > > > > ConnectEvent Script, "OnError", "OnError" > > > > Dim Func1 > > Set Func1 = New CFunc1 > > Set Func1 = Nothing > > > > ' ======8<--- cut here --------- > > > > -- > To insure that you receive proper support, please include all past > correspondence (where applicable), and any relevant information > pertinent to your situation when submitting a problem report to the GW > Micro Technical Support Team. > > Aaron Smith > GW Micro > Phone: 260/489-3671 > Fax: 260/489-2608 > WWW: http://www.gwmicro.com > FTP: ftp://ftp.gwmicro.com > Technical Support & Web Development >