这个页面的验证码获取不到
https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
$Form1 = GUICreate("验证码窗口演示 QQ:76594695帅哥命苦 ", 333, 211)
$Label1 = GUICtrlCreateLabel("验证码:", 16,43, 70, 17)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("更换验证码", 112, 150, 97, 33, 0)
$oIE_code = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE_code, 80,24,150,50);定义内嵌IE 窗口大小
_IENavigate ($oIE_code, "about:blank",1)
;加载一个空白网页,可以自定一个网页,让验证码图片显示左左对齐,顶部对齐,如果你会HTML应该明白什么意思
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, 'IE加载中...', "afterbegin");在嵌入IE底部追加文字
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$oIE = _IECreate ("https://login.sina.com.cn/cgi/register/reg_sso.php");打开带验证码的网页,可以隐藏IE
$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx");打开带验证码的网页,可以隐藏IE
Get_code()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_IEQuit ($oIE);退出脚本关闭IE
Exit
Case $Button1
_IELinkClickByText($oIE,"看不清?换一张")
Sleep(300);如果不能同步网页中的图片这个延迟要大点,可能跟网速有关系吧
Get_code()
EndSwitch
WEnd
Func Get_code()
$oImg = _IEImgGetCollection ($oIE,8);返回IE文档内IMG 实际上就是第4+1张图
$oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.execCommand("Copy");复制到剪贴板
$ImageFilePath = ClipGet();获取路径,在临时文件里面
_IEAction ( $oIE_code,"refresh" );刷新嵌入IE页面
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, '<img src='& FileGetShortName($ImageFilePath) &'>', "afterbegin");在嵌入IE底部追加图片显示
EndFunc
已经解决,谢谢各位的帮助
代码如下#include <IE.au3>
#include <GUIConstants.au3>
#include <ClipBoard.au3>
#include <GDIPlus.au3>
#include <Winapi.au3>
;$OpenPage = _IECreate("https://passport.baidu.com/?reg")
$OpenPage = _IECreate("http://ent.114mall.cn/ssoservice/Login.aspx")
$iVerifyPic = _IEImgGetCollection($OpenPage, 8)
_GDIPlus_Startup()
$iVerifyPics = $OpenPage.Document.body.createControlRange()
$iVerifyPics.add($iVerifyPic)
$iVerifyPics.Select ()
$iVerifyPics.execCommand('Copy')
Sleep(500)
_ClipBoard_Open(0)
$iVerifyPics = _ClipBoard_GetDataEx($CF_BITMAP)
$iVerifyPics = _GDIPlus_BitmapCreateFromHBITMAP($iVerifyPics)
_ClipBoard_Close()
FileDelete(@TempDir & "\VerifyPic.bmp")
_GDIPlus_ImageSaveToFile($iVerifyPics, @TempDir & "\VerifyPic.bmp")
GUICreate("VerifyPic", 150, 150, -1, -1, -1)
GUISetBkColor(0xFFFFFF)
GUISetState()
$Img = GUICtrlCreatePic(@TempDir & "\VerifyPic.bmp", 10, 20, _GDIPlus_ImageGetWidth($iVerifyPics), _GDIPlus_ImageGetHeight($iVerifyPics))
_GDIPlus_BitmapDispose($iVerifyPics)
_GDIPlus_Shutdown()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then
GUIDelete()
ExitLoop
EndIf
WEnd
[ 本帖最后由 zzzhanghc 于 2008-12-30 08:55 编辑 ] https://sso.114mall.com.cn:80/sso/imageValidate #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
$Form1 = GUICreate("验证码窗口演示 ", 333, 211)
$Label1 = GUICtrlCreateLabel("验证码:", 16,43, 70, 17)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("更换验证码", 112, 150, 97, 33, 0)
$oIE_code = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE_code, 80,24,150,50);定义内嵌IE 窗口大小
_IENavigate ($oIE_code, "about:blank",1)
;加载一个空白网页,可以自定一个网页,让验证码图片显示左左对齐,顶部对齐,如果你会HTML应该明白什么意思
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, 'IE加载中...', "afterbegin");在嵌入IE底部追加文字
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$oIE = _IECreate ("https://login.sina.com.cn/cgi/register/reg_sso.php");打开带验证码的网页,可以隐藏IE
$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx",0,0);打开带验证码的网页,可以隐藏IE
Get_code()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_IEQuit ($oIE);退出脚本关闭IE
Exit
Case $Button1
Get_code()
EndSwitch
WEnd
Func Get_code()
_IEAction ( $oIE_code,"refresh" );刷新嵌入IE页面
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, '<img src='& FileGetShortName("https://sso.114mall.com.cn:80/sso/imageValidate") &'>', "afterbegin");在嵌入IE底部追加图片显示
EndFunc
你要的是不是这个效果?:face (33): :face (33):
[ 本帖最后由 gaofali258 于 2008-12-29 10:56 编辑 ] 谢谢以上各位的回复!
我没有说清楚问题:
1.我要获取已经打开页面的验证码$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx");
2.这个IE中的验证码和https://sso.114mall.com.cn:80/sso/imageValidate是不一样的
应为1和2是两次不同的请求,所以不一样啊 看看这个帖子
http://www.autoitx.com/forum.php?mod=viewthread&tid=4178&extra=&page=1 又是空贴。。。。
页:
[1]