Jump to content

can't access XML simultaneously?


leevy
 Share

Recommended Posts

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://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

can't upload my xml file, please use:

<wing>

<report>

<PSOreport>

<bugreport>

<title>HZ-PSO-$projectname($memonumber) bug report</title>

<sql>/*<!--*/ /*-->*/</sql>

</bugreport>

<dashboard>

<title>HZ-PSO-$projectname($memonumber) bug dashboard</title>

<sql>/*<!--*/ /*-->*/</sql>

</dashboard>

</PSOreport>

<QAtemplate>

<bugreport>

<title>test title</title>

<sql>test sql</sql>

</bugreport>

<dashboard>

<title>test title 1</title>

<sql>test sql 1</sql>

</dashboard>

</QAtemplate>

<DEVtemplate>

<bugreport>

<title>test title 2</title>

<sql>TEST SQL 2</sql>

</bugreport>

<dashboard>

<title>test title 3</title>

<sql>test sql 3</sql>

</dashboard>

</DEVtemplate>

</report>

<readme>

<PM/>

</readme>

</wing>

Edited by leevy
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...