Sign in to follow this  
Followers 0
leevy

can't access XML simultaneously?

3 posts in this topic

#1 ·  Posted (edited)

hello,

My script has a warning when I input "Memo #" and press enter key, it says:"--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)"

please help me, thanks.

my scrip is the following:

#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include <_XMLDomWrapper.au3>


Global $memonum, $memoname
Global $bugreporttemplate, $template, $tmpvalue

_Main()

Func _Main()
; Create the GUI window and controls
    GUICreate("Wing 1.0", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)

    GUISetIcon("Wing_1.ico")

    $tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )


    $tabitem1 = GUICtrlCreateTabItem("version file")

    $memonumlabel = GUICtrlCreateLabel("Memo #", 25, 75, 80, 20, 0x0200)
    $memonum = GUICtrlCreateInput("", 105, 75, 80, 20, 0x0080)
    $bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)
    $bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)   
    $cancelbutton = GUICtrlCreateButton("Cancel", 260, 465, 60, 20)
; Run the GUI until it is closed
        _Readtemplate("data resource\resource.xml", "/wing/report/*")
        GUICtrlSetData($bugreporttemplate, $template,$tmpvalue[1])
    GUISetState()
    
        ControlFocus ( "Wing 1.0", "", $memonum)
            
;get bug report template

    While 1

        $msg = GUIGetMsg()
    ; memo number inputbox get focus
            
            Select
                Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                    ExitLoop
                    
                case $msg = $memonum

                    _getxmlvaluefromAPI("http://172.16.33.12/Admin/WebService/Service.asmx/Login", "name", "weiqinl", "password", "Leevy781005")
                    $APIticket = _XMLGetValue('//Ticket')

                    _getxmlvaluefromAPI("http://172.16.33.12/Admin/WebService/Service.asmx/GetMemo", "MemoNum", GUICtrlRead($memonum), "ticket", $APIticket[1])
                    $APIMemoData = _XMLGetValue('//MemoData')
                    ConsoleWrite($APIMemoData)
                    $oIE = _IECreate("about:blank",0,0,1)   
                    $memodatatmp = _IEPropertyGet($oIE, "innertext")

            EndSelect
    WEnd

    Exit
EndFunc  

Func _getxmlvaluefromAPI($url, $paraname1, $paravalue1, $paraname2, $paravalue2)
    $objHTTP = ObjCreate("Microsoft.XMLHTTP")
    $APIloginUrl= $url&"?"&$paraname1&"="&$paravalue1&"&"&$paraname2&"="&$paravalue2
    $objHTTP.Open("Get", $APIloginUrl, False )
    $objHTTP.Send
    $xml = $objHTTP.ResponseText
                
    $newxml= StringReplace( $xml, ' xmlns="http://www.xxxx.com/"', '' )
    _XMLLoadXML($newxml)
EndFunc

Func _Readtemplate($xmlfilename,$path)
    $sXML = $xmlfilename
    If _XMLFileOpen($sXML,"",-1) = -1 Then
        ConsoleWrite("can′t open file!" & @CRLF)
        Exit
    EndIf
    $tmpvalue = _XMLSelectNodes($path)
    $template = $tmpvalue[1]
    for $i = 2 to _ArrayMax($tmpvalue)
        $template =$template&"|"&$tmpvalue[$i]
    Next
    FileClose($sXML)
EndFunc

my xml file is attached.

Edited by leevy

Share this post


Link to post
Share on other sites



hello,

My script has a warning when I input "Memo #" and press enter key, it says:"--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)"

please help me, thanks.

my scrip is the following:

CODE
#include <GuiConstantsEx.au3>

#include <EditConstants.au3>

#include <WindowsConstants.au3>

#include <Array.au3>

#include <IE.au3>

#include <_XMLDomWrapper.au3>

Global $memonum, $memoname

Global $bugreporttemplate, $template, $tmpvalue

_Main()

Func _Main()

; Create the GUI window and controls

GUICreate("Wing 1.0", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)

GUISetIcon("Wing_1.ico")

$tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )

$tabitem1 = GUICtrlCreateTabItem("version file")

$memonumlabel = GUICtrlCreateLabel("Memo #", 25, 75, 80, 20, 0x0200)

$memonum = GUICtrlCreateInput("", 105, 75, 80, 20, 0x0080)

$bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)

$bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)

$cancelbutton = GUICtrlCreateButton("Cancel", 260, 465, 60, 20)

; Run the GUI until it is closed

_Readtemplate("data resource\resource.xml", "/wing/report/*")

GUICtrlSetData($bugreporttemplate, $template,$tmpvalue[1])

GUISetState()

ControlFocus ( "Wing 1.0", "", $memonum)

;get bug report template

While 1

$msg = GUIGetMsg()

; memo number inputbox get focus

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

case $msg = $memonum

_getxmlvaluefromAPI("http://10.100.12.204/Admin/WebService/Service.asmx/Login", "name", "weiqinl", "password", "Leevy781005")

$APIticket = _XMLGetValue('//Ticket')

_getxmlvaluefromAPI("http://10.100.12.204/Admin/WebService/Service.asmx/GetMemo", "MemoNum", GUICtrlRead($memonum), "ticket", $APIticket[1])

$APIMemoData = _XMLGetValue('//MemoData')

ConsoleWrite($APIMemoData)

$oIE = _IECreate("about:blank",0,0,1)

$memodatatmp = _IEPropertyGet($oIE, "innertext")

EndSelect

WEnd

Exit

EndFunc

Func _getxmlvaluefromAPI($url, $paraname1, $paravalue1, $paraname2, $paravalue2)

$objHTTP = ObjCreate("Microsoft.XMLHTTP")

$APIloginUrl= $url&"?"&$paraname1&"="&$paravalue1&"&"&$paraname2&"="&$paravalue2

$objHTTP.Open("Get", $APIloginUrl, False )

$objHTTP.Send

$xml = $objHTTP.ResponseText

$newxml= StringReplace( $xml, ' xmlns="http://QAForum.webex.com/"' '' )

_XMLLoadXML($newxml)

EndFunc

Func _Readtemplate($xmlfilename,$path)

$sXML = $xmlfilename

If _XMLFileOpen($sXML,"",-1) = -1 Then

ConsoleWrite("can′t open file!" & @CRLF)

Exit

EndIf

$tmpvalue = _XMLSelectNodes($path)

$template = $tmpvalue[1]

for $i = 2 to _ArrayMax($tmpvalue)

$template =$template&"|"&$tmpvalue[$i]

Next

FileClose($sXML)

EndFunc

my xml file is attached.
It is just a warning and can be safely ignored. The _XMLDOMWrapper.au3 UDF registers a COM error handler, so IE.au3 can't. It's not a problem unless you need to debug within IE.au3.

I don't understand what you expect to get back for innertext on browser object when all you have loaded is about:blank. Maybe that is triggering the attempt to display an error.

Also, the current version of IE.au3 is v2.4-1. Are you running an outdated version of AutoIt?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I don't understand what you expect to get back for innertext on browser object when all you have loaded is about:blank. Maybe that is triggering the attempt to display an error.

Yes, you are right.

Share this post


Link to post
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
Sign in to follow this  
Followers 0