Results 1 to 4 of 4

Thread: AutoIt and RoadRunner: how do you check for RoadRunner / handling -1 errors

  1. #1
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520

    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 ?

  2. #2
    The Curator
    Auto Apps:loading...
    Blue ZX3's Avatar
    Join Date
    Aug 2004
    Location
    Chicago area,IL
    Posts
    5,078
    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.

    Current Project: DFXVoice [v1.0 Released]
    Next in line: RRMedia v2.0

    DFX 5.1.1 Skin
    Appstore Link

    My RideRunner Plugins
    RRMedia
    RRExtended
    DFXVoice

    "There are no bugs - only undocumented features."

  3. #3
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520
    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

  4. #4
    The Curator
    Auto Apps:loading...
    Blue ZX3's Avatar
    Join Date
    Aug 2004
    Location
    Chicago area,IL
    Posts
    5,078
    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.

    Current Project: DFXVoice [v1.0 Released]
    Next in line: RRMedia v2.0

    DFX 5.1.1 Skin
    Appstore Link

    My RideRunner Plugins
    RRMedia
    RRExtended
    DFXVoice

    "There are no bugs - only undocumented features."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •