|
本帖最后由 jhkdqaa 于 2009-5-19 10:58 编辑
我用CoProc.au3,企图模拟多线操作。但是子窗口的代码出现了问题。
当只调用ie时 代码正常运行。当将ie嵌入窗口,代码在操作子窗口时出现错误:
变量类型必须为对象类型("object")
请问是什么原因造成的?
怎样对特定窗口操作?期待高手帮忙
其中一个func:
Func madeinchina()
$Form3 = GUICreate("每日自动刷新", 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
$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
EndSelect
WEnd |
|