找回密码
 加入
搜索
查看: 6851|回复: 7

[IE类操作] 内嵌IE如何复制验证码

  [复制链接]
发表于 2012-6-22 00:57:50 | 显示全部楼层 |阅读模式
本帖最后由 geary 于 2012-6-22 13:05 编辑

原本没用内嵌IE可以把验证码保存到本地,但在复制图片时会弹出对话框,听别人说内嵌IE就不会弹出对话框,所以用了内嵌IE,但却无法复制验证码保存到本地,求帮助。刚才又测试了下,xp成功过一次,之后就没成功过,win7的话一直没成功。。
#include <IE.au3>
#include <Clipboard.au3>
#Include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Button1", 248, 384, 75, 25)
GUICtrlSetOnEvent(-1, "pp1")
$xxs  =_IECreateEmbedded ()
GUICtrlCreateObj($xxs, 24, 8, 561, 369)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd


Func Form1Close()
        Exit
EndFunc  

Func pp1()
$oIE = _IENavigate($xxs,"http://reg.email.163.com/mailregAll/reg0.jsp?from=163mail_right")
$ss = _IEGetObjById($xxs ,"unameInp")
_IEFormElementSetValue ($ss, "asdas")
$ss = _IEGetObjById($xxs,"passwInp")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"passConfim")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"vcode_img")
$oPic = $xxs.Document.body.createControlRange()
$oPic.Add($ss)
$oPic.execCommand("copy")
$bmp = ClipGet()
_GDIPlus_Startup()
_ClipBoard_Open(0)
$iVerifyPics = _ClipBoard_GetDataEx($CF_BITMAP)
$iVerifyPics = _GDIPlus_BitmapCreateFromHBITMAP($iVerifyPics)
_ClipBoard_Close()
FileDelete(@ScriptDir & "\123.bmp")
_GDIPlus_ImageSaveToFile($iVerifyPics, @ScriptDir & "\123.bmp")
EndFunc
发表于 2012-6-22 01:33:55 | 显示全部楼层
经过测试,可以复制啊
 楼主| 发表于 2012-6-22 12:49:48 | 显示全部楼层
回复 2# drunk


    纳尼??你什么系统的,win7不可以
发表于 2012-6-22 14:06:16 | 显示全部楼层
回复 3# geary
在35行后面加上sleep(100)

评分

参与人数 1金钱 +10 贡献 +2 收起 理由
geary + 10 + 2 谢谢,加了还是不行哦~

查看全部评分

发表于 2012-6-22 15:37:56 | 显示全部楼层
那就再把时间延长点
发表于 2012-6-22 17:40:20 | 显示全部楼层
$ss = _IEGetObjById($xxs,"vcode_img")
这句下加个延时
#include <IE.au3>
#include <Clipboard.au3>
#Include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Button1", 248, 384, 75, 25)
GUICtrlSetOnEvent(-1, "pp1")
$xxs  =_IECreateEmbedded ()
GUICtrlCreateObj($xxs, 24, 8, 561, 369)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd


Func Form1Close()
        Exit
EndFunc  

Func pp1()
_IENavigate($xxs,"http://reg.email.163.com/mailregAll/reg0.jsp?from=163mail_right")
$ss = _IEGetObjById($xxs ,"unameInp")
_IEFormElementSetValue ($ss, "asdas")
$ss = _IEGetObjById($xxs,"passwInp")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"passConfim")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"vcode_img")
Sleep(1000)

$oPic = $xxs.Document.body.createControlRange()
$oPic.Add($ss)
$oPic.execCommand("copy")
$bmp = ClipGet()
_GDIPlus_Startup()
_ClipBoard_Open(0)
$iVerifyPics = _ClipBoard_GetDataEx($CF_BITMAP)
$iVerifyPics = _GDIPlus_BitmapCreateFromHBITMAP($iVerifyPics)
_ClipBoard_Close()
FileDelete(@ScriptDir & "\123.bmp")
_GDIPlus_ImageSaveToFile($iVerifyPics, @ScriptDir & "\123.bmp")
EndFunc
 楼主| 发表于 2012-6-23 15:04:59 | 显示全部楼层
回复 6# wua0550


    win7加了还是无效果。
 楼主| 发表于 2012-6-23 15:06:49 | 显示全部楼层
回复 5# zldfsz

加到5秒还是没成,win7的系统
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-28 03:30 , Processed in 0.108886 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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