
Je souhaiterais apprendre à gérer les erreurs avec autoit
pouvez vous svp m'indiquer quel est la bonne manière de
procéder avec si possible un exemple de code ?
Merci d'avance pour vos explications


Jean Marc
Code : Tout sélectionner
if not @error =0 then
msgbox(16,"Erreur","Erreur sur la fonction XXX")
exit
Endif
Code : Tout sélectionner
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc"), $EventError = 0
Func MyErrFunc()
Local $msg, $HexNumber = Hex($oMyError.number, 8)
Switch $HexNumber
Case "_80020009"
$msg = MsgBox(4 + 16, " Erreur " & $oMyError.scriptline, _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"Risque de doublons" & @LF & @LF & "continuer ?")
SetError(1, 1)
Case Else
$msg = MsgBox(4 + 16, "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 & $HexNumber & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext & @CRLF & @CRLF & _
"Continuer ???")
SetError(1, 9)
EndSwitch
If $msg <> 6 Then Exit
EndFunc ;==>MyErrFunc
Code : Tout sélectionner
Global Enum _
$ERR_TRUC, _
$ERR_MACHIN, _
$ERR_ETC