Jump to content

Recommended Posts

Posted

thank you for your read.

i useing CoProc.au3 to keep some loops run at the same time in dinfferent Process as it support this.

but the problem is when i run ie directly the code is fine,when i run a ie in a windows i got a error:Variable must be ("object")

my autoit is in chinese,i don't know Whether the describe of error is correct.

[/code]


Func madeinchina()
    $Form3 = GUICreate("madeinchina自动刷新", 840, 631, 189, 117)
    $oIE3 = _IECreateEmbedded()
    GUICtrlCreateObj($oIE3, 16, 16, 809, 500)
    Dim $dbname = "D:\database.mdb"
    $oIE3.navigate("http://membercenter.made-in-china.com/sign-in/")
    GUISetState(@SW_SHOW)
    While 1
        $msg = GuiGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case Else
                If WinExists("madeinchina自动刷新") Then
                    $conn3 = ObjCreate("ADODB.Connection")
                    $rs3 = ObjCreate("ADODB.Recordset")
                    $conn3.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $dbname & ";Jet Oledb:Database ")
                    $rs3.ActiveConnection = $conn3
                    $rs3.Open("Select * From allcustomer where website = 'madeinchina'")
                    while Not $rs3.eof And Not $rs3.bof
                        if @error = 1 Then ExitLoop
                        $UserName = _IEGetObjById($oIE3, "logonInfo.logUserName")
                        If IsObj($UserName) Then $UserName.value = $rs3.Fields(1).value
                        $PassWord = _IEGetObjById($oIE3, "logonInfo.logPassword")
                        If IsObj($PassWord) Then $PassWord.value = $rs3.Fields(2).value
                        $submit = _IEGetObjByName($oIE3, "imageField")
                        If IsObj($submit) Then $submit.click
                        _IELoadWait($oIE3)
                        $oIE3.navigate("http://membercenter.made-in-china.com/product.do?xcase=list")
                        _IELoadWait($oIE3)
                        $lForm = _IEFormGetObjByName($oIE3, "list")
                        $cols = _IETagNameGetCollection($lForm, "input")
                        For $k in $cols
                            If String($k.title) = "Select All" Then
                                _IEAction($k, "click")
                                _IELoadWait($oIE3)
                                If String($k.onclick) = "doResubmit()" Then
                                    _IEAction($k, "click")
                                    _IELoadWait($oIE3)
                                    ExitLoop
                                EndIf
                            EndIf
                        Next
                        $oIE3.navigate("http://membercenter.made-in-china.com/offer.do?xcase=list")
                        _IELoadWait($oIE3)
                        For $k in $cols
                            If String($k.title) = "Select All" Then
                                _IEAction($k, "click")
                                _IELoadWait($oIE3)
                                If String($k.onclick) = "doResubmit()" Then
                                    _IEAction($k, "click")
                                    _IELoadWait($oIE3)
                                    ExitLoop
                                EndIf
                            EndIf
                        Next
                        _IELinkClickByText($oIE3, "Sign Out")
                        _IELoadWait($oIE3)
                        $oIE3.navigate("http://membercenter.made-in-china.com/sign-in/")
                        _IELoadWait($oIE3)
                        $rs3.movenext
                    WEnd
                    While ProcessExists($gi_CoProcParent)
                        _CoProcSend($gi_CoProcParent, "madeinchina|" & "请稍后。。正在更新第" & $rs3 & "个客户")
                        Sleep(2000)
                    WEnd
                    $rs3.close
                    $conn3.Close
                    if ProcessExists($gi_CoProcParent) then
                        _CoProcSend($gi_CoProcParent, "madeinchina|" & "更新完成,共更新了" & $rs3 & "个客户")
                    EndIf
                EndIf
        EndSelect
    WEnd
EndFunc 
[code]

this is one of my func,the error is in this part:

$UserName = _IEGetObjById($oIE3, "logonInfo.logUserName")

If IsObj($UserName) Then $UserName.value = $rs3.Fields(1).value

will anyone help me?i will be very gratefulll!

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
×
×
  • Create New...