你說的是 查不到數據 程式就會發生錯誤吧!!! 那個是 COM 的錯誤 設個計個 容錯的 就可以了....
新增 MyErrFunc.AU3 內容如下
; Script Start - Add your code below here
#include-once
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Func MyErrFunc()
Local $errstr="COM 錯誤訊息 !!!"& @CRLF & @CRLF & _
"錯誤描述:" & @TAB & $oMyError.description & @CRLF & _
"WIN 錯誤描述:" & @TAB & $oMyError.windescription & @CRLF & _
"錯誤代碼:" & @TAB & hex($oMyError.number,8) & @CRLF & _
"上次 DLL 錯誤:" & @TAB & $oMyError.lastdllerror & @CRLF & _
"錯誤腳本行:" & @TAB & $oMyError.scriptline & @CRLF & _
"錯誤來源:" & @TAB & $oMyError.source & @CRLF & _
"錯誤幫助檔:" & @TAB & $oMyError.helpfile & @CRLF & _
"錯誤幫助功能表:" & @TAB & $oMyError.helpcontext & @CRLF
FileWrite(@ScriptDir&"\ErrorLog.log",@YEAR&@MON&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" ..... "&$errstr&@CRLF&@CRLF&@CRLF)
Msgbox(0,"AutoIt COM 錯誤",$errstr,30)
Local $err = $oMyError.number
If $err = 0 Then $err = -1
$g_eventerror = $err ; to check for after this function returns
Endfunc
然後在你的程式裡面 #include 進來 就可以了 |