|
Opt("TrayMenuMode",1)
Opt("TrayOnEventMode",1)
TraySetIcon("Shell32.dll",290)
;239、274、275、290、、、、、、、
$trayExit = TrayCreateItem("退出程序")
TraySetState()
TrayItemSetOnEvent($trayExit, "trayExit")
#include <IE.au3>
$i=0
$oIE = _IECreate ("http://www.9street.org/pic/url.html",0,1,1,0)
$sHTML = _IEBodyReadHTML ($oIE)
$sHTML = StringStripCR($sHTML)
$aArray = StringSplit($sHTML,'$$$$$$',1) ; 从网站提取目标收藏商品链接
;_____________________________________________ 登陆部分 开始 __________________________________
_IENavigate ($oIE,"http://member1.taobao.com/member/login.jhtml?style=simple&redirectURL=http%3A%2F%2Fsearch1.taobao.com%2Fbrowse%2Fad_search_shop.htm")
MsgBox(4096, "提示信息", "请手动登录淘宝网 ;登录成功后,再点确定按钮 ")
Sleep(2000)
;_____________________________________________ 登陆部分 结束 __________________________________
For $n = 1 to UBound($aArray)-2 ; 循环开始 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$tmp = StringSplit($aArray[$n],'$$$',1)
$aTag = StringLeft(StringStripWS(StringStripWS($tmp[1],1),2),20)
$aUrl = StringReplace(StringStripWS(StringStripWS($tmp[2],1),2),"amp;","")
$aErr = _IENavigate ($oIE,$aUrl)
if ($aErr=0) then
$aErr = _IENavigate ($oIE,$aUrl)
endif
if ($aErr=0) then
$aErr = _IENavigate ($oIE,$aUrl)
endif
$sHTML = _IEBodyReadHTML ($oIE)
if ( StringInStr($sHTML, "请登录")>0 ) then ;判断是否异常退出了 开始________________
_IENavigate ($oIE,"http://member1.taobao.com/member/login.jhtml?style=simple&redirect_url=&yparam=&done=&f=&redirectURL=http%3A%2F%2Fsearch1.taobao.com%2Fbrowse%2Fad_search_shop.htm")
MsgBox(4096, "提示信息", "请手动登录淘宝网 ;登录成功后,再点确定按钮 ")
Sleep(2000)
$aErr = _IENavigate ($oIE,$aUrl)
if ($aErr=0) then
$aErr = _IENavigate ($oIE,$aUrl)
endif
if ($aErr=0) then
$aErr = _IENavigate ($oIE,$aUrl)
endif
$sHTML = _IEBodyReadHTML ($oIE)
if ( StringInStr($sHTML, "请登录")>0 ) then
MsgBox(4096, "提示信息", "必须重新运行程序,原因:须重新登录网站 ")
_IEQuit ($oIE)
Exit
endif
endif ;判断是否异常退出了 结束________________
if ( StringInStr($sHTML, "已经收藏过了")<1 ) then ;判断是否收藏过 开始____________________
$oForm = _IEFormGetCollection ($oIE, 0)
$oTexta = _IEFormElementGetObjByName ($oForm, "tags")
_IEFormElementSetValue ($oTexta, $aTag) ;不能超过20个字符,最多三个空格
_IEFormElementCheckboxSelect ($oForm, 0,"shopIncluded", 1, "byIndex")
if ( StringInStr($sHTML, "验证码:")>0 ) then
$aCode = InputBox("提示信息", "请输入淘宝变态四位验证码", "", "", -1, -1, 0, 0)
$oCode =_IEFormElementGetObjByName ($oForm, "inputCode")
_IEFormElementSetValue ($oCode, $aCode)
endif
_IEFormSubmit ($oForm,1)
WinKill("http://favorite.taobao.com/popup/add_collection.htm?itemid=", "")
$oIE = _IEAttach ("http://favorite.taobao.com/popup/add_collect_success.htm","URL")
_IEAction ($oIE, "visible")
Sleep(6000)
$i=$i+1
endif ;判断是否收藏过 结束____________________
Sleep(1000) ;设置循环间隔时间
Next ; 循环结束 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ($i=0) then
MsgBox(4096, "提示信息", "OK,任务完成 ")
endif
if ($i>0) then
MsgBox(4096, "提示信息", "OK,任务完成,共收藏了 "&$i&" 个商品 ")
endif
_IEQuit ($oIE)
Func trayExit()
_IEQuit ($oIE)
Exit
EndFunc |
|