Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Front Ends > Road Runner


Reply
 
Share Thread Tools Display Modes
Old 03-04-2009, 05:00 AM   #1
Maximum Bitrate
 
Join Date: Aug 2004
Location: Germany
Posts: 461
Konrad is on a distinguished road
AutoIt and RoadRunner: how do you check for RoadRunner / handling -1 errors

I have a problem handling errors in AutoIt. What I want to do is avoid the typical -1 error message.

1. how do you handle it generally, so that error message doesn't appear ?

2. This is how I check for RoadRunner to avoid errors when using the RoadRunner object.

Code:
Func _rr_getinfo($info) if not WinExists("RideRunner") and not WinExists("RoadRunner") then exit if not ProcessExists("RideRunner.exe") and not ProcessExists("RoadRunner") then exit if IsObj($rr) then return $rr.getinfo($info) else exit endif EndFunc Func _rr_execute($command) if not WinExists("RideRunner") and not WinExists("RoadRunner") then exit if not ProcessExists("RideRunner.exe") and not ProcessExists("RoadRunner") then exit if IsObj($rr) then $rr.execute($command) else exit endif return EndFunc

As you can see it's a little complicated, because I tried to catch every eventuality. Still I sometimes get an object error.
Why ? How do I fix this ?
Konrad is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 03-04-2009, 10:13 AM   #2
The Curator
 
Blue ZX3's Avatar
 
Join Date: Aug 2004
Location: Chicago area,IL
Posts: 3,565
Blue ZX3 will become famous soon enoughBlue ZX3 will become famous soon enough
Code:
; ; This info can be found in the autoit help file under the ObjEvent ; ;you can globaly define this $oRR_Error = ObjEvent("AutoIt.Error","MyErrFunc") Func MyErrFunc() Switch $oRR_Error.number Case 169,-2147220994 ; If either the object doesn't exsits or it can't be created Exit Case Else ;If its not either of the above two error display a msgbox telling what the error was ;If its an error you want to trap as well, write down the number and add it to either ;the above case statement or to its own and do what ever you need to do when that error occurs. Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext ) EndSwitch Endfunc

And the reason that you might be still getting that error is because even if the proc & window exsit doesn't mean that between those checks and the object call that RR could be shutting down and would still cause the error. Though a very small window, still wiggle room for it to occur.
__________________
RideRunner...The #1 FE, PERIOD.

RR Media >>HERE <<

RRExtended Plugin
Updated RR Config (Current Ver 1.0.2.0)
Old RR Versions
Complete CFX PSD Set
RRSkinEditor v.76c
DFX Btn Editor

Last edited by Blue ZX3; 03-04-2009 at 10:16 AM.
Blue ZX3 is offline   Reply With Quote
Old 03-04-2009, 11:17 AM   #3
Maximum Bitrate
 
Join Date: Aug 2004
Location: Germany
Posts: 461
Konrad is on a distinguished road
Thanks for your answer blue .

This does just trap object errors, though...which is enough for RoadRunner, so this is sorted.

But do you also know how to handle "standard" errors, f.ex. wrong expression or similiar ?

Thanks
Konrad is offline   Reply With Quote
Old 03-04-2009, 12:30 PM   #4
The Curator
 
Blue ZX3's Avatar
 
Join Date: Aug 2004
Location: Chicago area,IL
Posts: 3,565
Blue ZX3 will become famous soon enoughBlue ZX3 will become famous soon enough
No, and i don't think that you can becuse that is an internal AI error. If you do a syntax check when you compile them, you should never get any of those anyway. CTRL F5 in SciTE editor will check for proper syntax. And if using any arrays add checks to make sure that you never try to access a array element that is out of bounds of the array.
__________________
RideRunner...The #1 FE, PERIOD.

RR Media >>HERE <<

RRExtended Plugin
Updated RR Config (Current Ver 1.0.2.0)
Old RR Versions
Complete CFX PSD Set
RRSkinEditor v.76c
DFX Btn Editor
Blue ZX3 is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




All times are GMT -5. The time now is 02:38 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics