找回密码
 加入
搜索
查看: 4650|回复: 12

[IE类操作] (已解决)为什么登陆淘宝的程序运行一次就死掉了?有没有办法解决?

  [复制链接]
发表于 2011-1-19 16:20:07 | 显示全部楼层 |阅读模式
本帖最后由 papapa314 于 2011-1-19 21:16 编辑

首先感谢smartzbs,帮助我把vbs转成了au3,我用自己的方法也解决了用户名中文出现乱码的问题,可是程序运行一次就死掉了,得重开才能再用,请教高手如何解决?
代码如下

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$Input1 = GUICtrlCreateInput("", 152, 168, 193, 21)
$Input2 = GUICtrlCreateInput("", 152, 224, 193, 21,$ES_PASSWORD)
#include <IE.au3>

GUISetState(@SW_SHOW)
$Button1 = GUICtrlCreateButton("Button1", 168, 304, 161, 41)
#EndRegion ### END Koda GUI section ###


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                        Case $Button1
MsgBox(0,"",GUICtrlRead($Input2))


$sUrl = "https://login.taobao.com/member/login.jhtml?redirect_url="
$oIE = _IECreate($sUrl)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 0)
_IEFormElementSetValue ($oQuery, GUICtrlRead($Input1))

$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery,GUICtrlRead($Input2) )

_IEFormSubmit($oForm)
        EndSwitch
WEnd
发表于 2011-1-19 18:36:40 | 显示全部楼层
测试过,没问题.
 楼主| 发表于 2011-1-19 19:19:24 | 显示全部楼层
回复 2# mo_shaojie
会有问题的,按了一次按钮后就不能再按第二次,不过已经解决了,要加个_ieloadwait
发表于 2011-1-19 21:07:15 | 显示全部楼层
回复  mo_shaojie
会有问题的,按了一次按钮后就不能再按第二次,不过已经解决了,要加个_ieloadwait
papapa314 发表于 2011-1-19 19:19


哦,那楼主发一下解决方法.
 楼主| 发表于 2011-1-19 21:14:25 | 显示全部楼层
回复 4# mo_shaojie


   用这样的:

$sUrl = "https://login.taobao.com/member/login.jhtml?redirect_url=[/url]"
        $oIE = _IECreate($sUrl)
        $oForm = _IEFormGetCollection ($oIE, 0)
        $oQuery = _IEFormElementGetCollection ($oForm, 0)
        _IEFormElementSetValue ($oQuery, GUICtrlRead($Input1))
        $oQuery = _IEFormElementGetCollection ($oForm, 1)
        _IEFormElementSetValue ($oQuery,GUICtrlRead($Input2) )
        _IEFormSubmit($oForm,0)
        _IELoadWait($oIE)

问题是我提出的,但是smartzbs解决的。如果我没错的话,这是目前论坛上唯一一个能够实现自动后台登陆淘宝的源码了呵呵,还是得感谢smartzbs
发表于 2011-1-19 21:19:03 | 显示全部楼层
嗯,不错的.
 楼主| 发表于 2011-1-19 21:24:37 | 显示全部楼层
回复 6# mo_shaojie


呵呵,谢谢!请大侠帮忙看一下另外一个问题:
http://www.autoitx.com/forum.php ... id=21307&extra=
发表于 2011-1-19 21:57:06 | 显示全部楼层
学习了~~~~~~
发表于 2011-2-7 22:25:43 | 显示全部楼层
记号一下   找到需要的东西了  
弱弱的问一下  这个可以用post实现吗 ?
 楼主| 发表于 2011-2-7 23:08:47 | 显示全部楼层
回复 9# cxlater

理论上post是可以,但是不知道淘宝是怎么把用户名和密码转换成特殊的编码,所以post实际上行不通的,除非知道这个编码的算法。
发表于 2011-2-7 23:19:45 | 显示全部楼层
我刚刚也正在研究这个东西  提交的数据中 用户名是没有加密,密码加密了,以前的login.jhtml的参数中密码是可以明文提交的   之前我一直是构建url提交的
因为我是做给自己用的  加密后的密码是不变化的 我的密码也是不变的 所以这不是什么问题  问题是参数_tb_token_        e45ef174534e3  每次的值是不一样的  
不过我用楼主给出的方式实现需要的功能了   还得感谢楼主
楼主是做淘宝的吗 ?
 楼主| 发表于 2011-2-7 23:34:27 | 显示全部楼层
回复 11# cxlater

呵呵,没有啦,我是来这边学技术的,有什么学什么,还得感谢这边无私帮助我的高手们!
 楼主| 发表于 2011-2-7 23:37:20 | 显示全部楼层
回复 11# cxlater

对了,还有一点需要指出的是,登录淘宝是用GET而不是用POST。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-2 14:23 , Processed in 0.076721 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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