找回密码
 加入
搜索
查看: 1893|回复: 3

ie打开一个新窗口如何索取新窗口的源码?

[复制链接]
发表于 2009-9-29 21:49:21 | 显示全部楼层 |阅读模式
$oIE = _IECreate ("http://www.uname.cn/html/dic/4/63_9084.shtml")
$a=_IEGetObjByName($oIE,"Query")
_IEFormElementSetValue ($a, $chars);账号
$oSubmit = _IEGetObjByName ($oIE, "Query")
_IEAction ($oSubmit, "focus")
Sleep(2000)
Send ("{enter}")
到这里就打开了一个新窗口,这个enter能不能有别的办法?下面是获取新窗口的地址
_IEQuit ($oIE)
Sleep(3000)
WinWait("在线字典","完毕")
If Not WinActive("在线字典","完毕") Then WinActivate("在线字典","完毕")
WinWaitActive("在线字典","完毕")
Sleep(2000)
$var = ControlGetText("在线字典", "", "Edit1")
有没有别的更好更简单的办法吗?
 楼主| 发表于 2009-9-29 23:11:43 | 显示全部楼层
haha 有什么办法吗?Send ("{enter}")老出错。到底要如何点击那个按钮?
发表于 2009-9-29 23:50:03 | 显示全部楼层
虽然你不赞成我的签名 但是我还是要回帖 让你从教程学
1 2 3 4

http://hi.baidu.com/iokey/blog/item/7135fdc36c601c57b319a833.html

评分

参与人数 1金钱 +3 收起 理由
ac5474012 + 3 不过我还是在改正呢~

查看全部评分

 楼主| 发表于 2009-10-8 19:31:29 | 显示全部楼层
我需要批量获取汉字的一些信息,网站是http://www.uname.cn。不过要知道我要干什么最简单就是运行一下我的程序。那就能明白了。
#include <IE.au3>
#include <Constants.au3>
#include <Date.au3>

$file = FileOpen("zi.txt", 0)
If $file = -1 Then
        MsgBox(0, "错误", "在脚本目录下建立zi.txt的文本文件在写几个汉字")
        Exit
EndIf
$sl = 0
While 1
        $chars = FileRead($file, 2)
        Sleep(1000)
        $oIE = _IECreate("http://www.uname.cn/dic/zidian.asp", 1, 1,1,1)
        Sleep(1000)
        $a = _IEGetObjByName($oIE, "gb")
        Sleep(1000)
        _IEFormElementSetValue($a, $chars)
        Sleep(1000)
        $oSubmit = _IEGetObjByName($oIE, "gb")
        Sleep(1000)
        $b = _IEGetObjByName($oIE, "Submit")
        Sleep(1000)
        _IEAction($b, "click")
        Sleep(1000)
        _IELoadWait($oIE)
        Sleep(1000)
        $sHTML = _IEBodyReadHTML($oIE)
        $Link = StringRegExp($sHTML, 'href="(/html/dic/[^"]+)">', 3)
        If @error = 0 Then
                $s = 'http://www.uname.cn' & $Link[0]
        Else
                IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤5-这将是个错误回馈,而且也会因此停止程序的运行", $s)
        EndIf
        $oIE2 = _XmlHttp($s)
        $sR = StringRegExp($oIE2, '#FFFFFF">(.*?)( )?</td>', 3)
        If @error = 0 Then
                IniWrite("e1.ini", "Section3", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & "_" & $chars, $sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9])
        ElseIf @error <> 0 Then
                IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤7", $chars & "," & $sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9])
        EndIf
        $sl = $sl + 1
        ToolTip($sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9], 50, 50, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & @CR & "已经完成了第" & $sl & "个字上一个是" & $chars, 0, 4)
WEnd

Func _XmlHttp($Url) ;Sanhen
        Local $oHTTP, $sReturn
        $oHTTP = ObjCreate("microsoft.xmlhttp")
        $oHTTP.Open("get", $Url, False)
        $oHTTP.Send()
        $sReturn = BinaryToString($oHTTP.responseBody)
        Return $sReturn
EndFunc   ;==>_XmlHttp
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 06:55 , Processed in 0.080550 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表