The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.
From:
Allison and Chip OrangeSubject:
to VBScript programmersDate:
Tue, Apr 20, 2010 10:10:18 amHi all,
just a tip for VBScript scripters which was biting me even though I didn't
know it. it is, in all of my scripts, I have some form of the following
structure:
on error resume next
on error goto 0
if err.number 0 then
' do something about error
end if
it turns out that "on error goto 0" clears the error condition, so testing
on the err.number property afterwards is useless apparently.
so, it looks like the correct way to do this is:
on error resume next
if err.number 0 then
on error goto 0
' do something about error
end if
on error goto 0
Aaron, this was my test to see if loadClassInformation succeeded or not, so
in the cases where it did not, because of some odd condition such as the
application was still initializing, it looks to me like I wouldn't have
known it, and so would have thought loadClassInformation was sometimes
failing without an error. How it failed on the second or third use of a
constant I can't explain, but I don't think there's a problem with
loadClassInformation any more.
Thanks to Gary Metzler for his help in tracing this down, and for working
with me on this error because he could reliably reproduce it.
Chip
just a tip for VBScript scripters which was biting me even though I didn't
know it. it is, in all of my scripts, I have some form of the following
structure:
on error resume next
on error goto 0
if err.number 0 then
' do something about error
end if
it turns out that "on error goto 0" clears the error condition, so testing
on the err.number property afterwards is useless apparently.
so, it looks like the correct way to do this is:
on error resume next
if err.number 0 then
on error goto 0
' do something about error
end if
on error goto 0
Aaron, this was my test to see if loadClassInformation succeeded or not, so
in the cases where it did not, because of some odd condition such as the
application was still initializing, it looks to me like I wouldn't have
known it, and so would have thought loadClassInformation was sometimes
failing without an error. How it failed on the second or third use of a
constant I can't explain, but I don't think there's a problem with
loadClassInformation any more.
Thanks to Gary Metzler for his help in tracing this down, and for working
with me on this error because he could reliably reproduce it.
Chip




