Jump to content

Errors in script


Docfxit
 Share

Recommended Posts

I'm getting errors that I would like some help in figuring out. 

The errors are:

(194,75) : error: _IEErrorHandlerRegister() already defined.
Func _IEErrorHandlerRegister($s_functionName = "__IEInternalErrorHandler")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(203,83) : error: __IEErrorNotify(): undefined function.
                "Error Handler Not Registered - Check existance of error function")

This is my Script:

;AutoIt_Debugger_Command:Disable_Debug
#include <array.au3>
#include <IE.au3>
Opt("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number
$oIE = _IE_Example("form")
 _Au3RecordSetup()


If @OSVersion = 'Win_7' Then
    $ProgramFiles = "C:\Programs\"
Else
    $ProgramFiles = "C:\Program Files\"
EndIf
;_IEErrorHandlerRegister()

;While 1 <> 1
Run('F:\Dnload\9xAddons\drivermaxVer.8.1.7.exe')
WinWait("Setup - DriverMax", "Welcome to the Drive")
If Not WinActive("Setup - DriverMax", "Welcome to the Drive") Then WinActivate("Setup - DriverMax", "Welcome to the Drive")
WinWaitActive("Setup - DriverMax", "Welcome to the Drive")
Send("{ENTER}")

_WinWaitActivate("Setup - DriverMax", " Innovative Solution")
Send("{ENTER}")
;AutoIt_Debugger_Command:Enable_Debug


;Get Active Window Title
;$var = WinList()
;Sleep(5000) ; Give me time to select the correct window
;For $i = 1 To $var[0][0]
; Only display visble windows that have a title
;   If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
;           MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1] & @CRLF & "ProcessId: " & WinGetProcess($var[$i][0]))
;   EndIf
;Next

$title = WinGetTitle("Alert", "")
WinActivate($title, "")
$text = WinGetText("", "")
$text = StringStripCR($text)
$TextLine = StringSplit($text, @LF)
; $TextLine[0] - will be count of lines in $Text
; $TextLine[1] - will be content of first line in $Text

;   MsgBox(0, "Text read was:", _ArrayDisplay($TextLine))
If $title = "Alert" And $TextLine[2] = "Allow" Then
    WinWait("Alert", "Allow")
    If Not WinActive("Alert", "Allow") Then WinActivate("Alert", "Allow")
    WinWaitActive("Alert", "Allow")
    ;Do
    $Button = ControlGetFocus("Alert", "Allow")
    ;       MsgBox(0, "ControlGetFocus Example", "The control that has focus is: " & $Button)
    ;   Local $text = WinGetClassList("Alert", "Allow")
    ;       MsgBox(0, "Text read was:", $text)

    ControlFocus("Alert", "Allow", "Button6") ; ZoneAlarm Allow if Remember this setting is on the window
    ControlClick("Alert", "Allow", "Button6", "Left", 1)
EndIf
;   MsgBox(0, "", "Was ZoneAlarm Message Answered")

WinWait("Setup - DriverMax", " Innovative Solution")
If Not WinActive("Setup - DriverMax", " Innovative Solution") Then WinActivate("Setup - DriverMax", " Innovative Solution")
;AutoIt_Debugger_Command:Disable_Debug
WinWaitActive("Setup - DriverMax", " Innovative Solution")
Send($ProgramFiles & "DriverMax")
;MsgBox(0, "", "Was Path Entered Correctly")
Send("{ENTER}")
;AutoIt_Debugger_Command:Enable_Debug

; License Agreement
WinWait("Setup - DriverMax", " Innovative Solution")
If Not WinActive("Setup - DriverMax", " Innovative Solution") Then WinActivate("Setup - DriverMax", " Innovative Solution")
;AutoIt_Debugger_Command:Disable_Debug
WinWaitActive("Setup - DriverMax", " Innovative Solution")
;Pin DriverMax to taskbar
Send("{ENTER}")

;AutoIt_Debugger_Command:Enable_Debug
ControlFocus("Setup - DriverMax", "Allow", "Button6") ; ZoneAlarm Allow if Remember this setting is on the window
ControlClick("Setup - DriverMax", "Allow", "Button6", "Left", 1)

$title = WinGetTitle("Setup - DriverMax", "")
WinActivate($title, "")
$text = WinGetText("", "")
$text = StringStripCR($text)
$TextLine = StringSplit($text, @LF)
; $TextLine[0] - will be count of lines in $Text
; $TextLine[1] - will be content of first line in $Text
;MsgBox(0, "Text read was:", _ArrayDisplay($TextLine))
If $title = "Setup - DriverMax" And $TextLine[5] = "Install Conduit Search Protect" Then
    ControlFocus("Setup - DriverMax", "Custom installation", "TNewButton1") ;  Custom installation
    ControlClick("Setup - DriverMax", "Custom installation", "TNewButton1", "Left", 1)
    MsgBox(0, "", "Custom installation Click was Tried")
EndIf
MsgBox(0, "", "Was Custom installation Answered?")
; This will show the info in an IE window...
Local $sHTML = _IEBodyReadHTML($oIE)
$sHTML = $sHTML & "<p><font color=red size=+5>Big RED text!</font>"
_IEBodyWriteHTML($oIE, $sHTML)
If @error Then MsgBox(0, 'Error - ' & @error, @extended)
MsgBox(0, "$sHTML", $sHTML)
Local $sHTML = _IEBodyReadHTML($oIE)
$sHTML = StringReplace($sHTML, "Choose this option if you purchased the product ", "<FONT color=red>Choose this option if you purchased the product </FONT>")
_IEBodyWriteHTML($oIE, $sHTML)
MsgBox(0, "", "What is on this screen?")

; Decline
;AutoIt_Debugger_Command:Disable_Debug
WinWait("Setup - DriverMax", " Innovative Solutions")
If Not WinActive("Setup - DriverMax", " Innovative Solutions") Then WinActivate("Setup - DriverMax", " Innovative Solutions")
WinWaitActive("Setup - DriverMax", " Innovative Solutions")
ControlClick("Setup - DriverMax", " Innovative Solutions", "TButton1", "Left", 1)
;AutoIt_Debugger_Command:Enable_Debug
; Finish and Launch DriverMax
;AutoIt_Debugger_Command:Disable_Debug
WinWait("Setup - DriverMax", " Innovative Solution")
If Not WinActive("Setup - DriverMax", " Innovative Solution") Then WinActivate("Setup - DriverMax", " Innovative Solution")
WinWaitActive("Setup - DriverMax", " Innovative Solution")
Send("{ENTER}")
;AutoIt_Debugger_Command:Enable_Debug
;   MsgBox(0, "", "Starting DriverMax")
;WEnd

If $title = "Alert" And $TextLine[2] = "Allow" Then
    WinWait("Alert", "Allow")
    If Not WinActive("Alert", "Allow") Then WinActivate("Alert", "Allow")
    WinWaitActive("Alert", "Allow")
    ControlFocus("Alert", "Allow", "Button6") ; ZoneAlarm Allow if Remember this setting is on the window
    ControlClick("Alert", "Allow", "Button6", "Left", 1)
EndIf
;WinWait("Exit Setup", "Setup is not complet")
;If Not WinActive("Exit Setup", "Setup is not complet") Then WinActivate("Exit Setup", "Setup is not complet")
;WinWaitActive("Exit Setup", "Setup is not complet")
;WinWait("Setup - DriverMax", " Innovative Solutions")
;If Not WinActive("Setup - DriverMax", " Innovative Solutions") Then WinActivate("Setup - DriverMax", " Innovative Solutions")
;WinWaitActive("Setup - DriverMax", " Innovative Solutions")
;   ControlClick("Setup - DriverMax", " Innovative Solutions", "TButton1", "Left", 1)
WinWait("Setup - DriverMax", "Completing the Drive")
If Not WinActive("Setup - DriverMax", "Completing the Drive") Then WinActivate("Setup - DriverMax", "Completing the Drive")
WinWaitActive("Setup - DriverMax", "Completing the Drive")
Send("{ENTER}")

WinWait("DriverMax - Mozilla Firefox", "")
If Not WinActive("DriverMax - Mozilla Firefox", "") Then WinActivate("DriverMax - Mozilla Firefox", "")
WinWaitActive("DriverMax - Mozilla Firefox", "")
If ProcessExists("Firefox.exe") Then
    ProcessClose("Firefox.exe")
EndIf

;WEnd

;   $title = WinGetTitle("classname=TMainDriverMaxWindow", "")
;   WinActivate($title, "")
;   $text = WinGetText("", "")
;   $text = StringStripCR($text)
;   $TextLine = StringSplit($text, @LF)
; $TextLine[0] - will be count of lines in $Text
; $TextLine[1] - will be content of first line in $Text

;   MsgBox(0, "Text read was:", _ArrayDisplay($TextLine))

WinWait("classname=TMainDriverMaxWindow", "FrmPanel")
If Not WinActive("classname=TMainDriverMaxWindow", "FrmPanel") Then WinActivate("classname=TMainDriverMaxWindow", "FrmPanel")
WinWaitActive("classname=TMainDriverMaxWindow", "FrmPanel")
ControlClick('classname=TMainDriverMaxWindow', 'Progress', 'TMetroButton1') ;Scan for updates now

Func _Au3RecordSetup()
    ;AutoIt_Debugger_Command:Disable_Debug
    Opt('WinWaitDelay', 100)
    Opt("WinTitleMatchMode", 4)
    Opt('WinDetectHiddenText', 1)
    Opt('MouseCoordMode', 0)
    ;AutoIt_Debugger_Command:Enable_Debug
EndFunc   ;==>_Au3RecordSetup

Func _WinWaitActivate($title, $text, $timeout = 0)
    ;AutoIt_Debugger_Command:Disable_Debug
    WinWait($title, $text, $timeout)
    If Not WinActive($title, $text) Then WinActivate($title, $text)
    WinWaitActive($title, $text, $timeout)
    ;AutoIt_Debugger_Command:Enable_Debug
EndFunc   ;==>_WinWaitActivate

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>IsVisible

Func _IEErrorHandlerRegister($s_functionName = "__IEInternalErrorHandler")
    $sIEUserErrorHandler = $s_functionName
    $oIEErrorHandler = ""
    $oIEErrorHandler = ObjEvent("AutoIt.Error", $s_functionName)
    If IsObj($oIEErrorHandler) Then
        SetError($_IEStatus_Success)
        Return 1
    Else
        __IEErrorNotify("Error", "_IEPropertySet", "$_IEStatus_GeneralError", _
                "Error Handler Not Registered - Check existance of error function")
        SetError($_IEStatus_GeneralError, 1)
        Return 0
    EndIf
EndFunc   ;==>_IEErrorHandlerRegister
;Func _IEErrorHandlerRegister($s_functionName = "__IEInternalErrorHandler")
;   $sIEUserErrorHandler = $s_functionName
;   $oIEErrorHandler = ""
;   $oIEErrorHandler = ObjEvent("AutoIt.Error", $s_functionName)
;   If IsObj($oIEErrorHandler) Then
;       Return SetError($_IEStatus_Success, 0, 1)
;   Else
;       _IEErrorNotify("Error", "_IEPropertySet", "$_IEStatus_GeneralError", _
;               "Error Handler Not Registered - Check existance of error function")
;       Return SetError($_IEStatus_GeneralError, 1, 0)
;   EndIf
;EndFunc   ;==>_IEErrorHandlerRegister

I just can't figure out how to fix them.

Thanks,

Docfxit

Link to comment
Share on other sites

The problem is that 

_IEErrorHandlerRegister

is already defined in the included file IE.au3 so you don't need it in your script. If you remove _IEErrorHandlerRegister from your main script then both errors will be solved.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...