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

[AU3基础] 这变量怎么不行呢

  [复制链接]
发表于 2012-3-27 20:14:41 | 显示全部楼层 |阅读模式
#include <IE.au3>
$file1 = FileOpen(@ProgramFilesDir& "\Internet Explorer\网址.txt", 0)
$file2 = FileOpen(@ProgramFilesDir& "\Internet Explorer\关键词.txt", 0)
$file3 = FileOpen(@ProgramFilesDir& "\Internet Explorer\链接.txt", 0)


While 1
$body1 = FileReadLine($file1)
$body2 = FileReadLine($file2)
$body3= FileReadLine($file3)
Local $oLinks = _IELinkGetCollection($body3)

if @error = -1 Then ExitLoop
#include <IE.au3>
$oie = _IECreate(""&$body1&"", 1)
$oForm = _IEFormGetObjByName ($oIE, "bdfm")
$oQuery = _IEFormElementGetObjByName ($oForm, "word")
_IEFormElementSetValue ($oQuery, ""&$body3&"")
$oQuery = _IEFormSubmit ($oForm, "0")
_IELinkClickByText($oIE,'"",1)Sleep (3000)
Sleep (1000)
;ProcessExists("IEXPLORE.exe")
ProcessClose("IEXPLORE.exe")
WEnd


"&$body3&"出粗了。怎么回事呢?
发表于 2012-3-27 20:41:47 | 显示全部楼层
<IE.au3>怎么include了两次?""&$body1&""、""&$body3&""两个变量前后加空字串什么意思啊?看不明白。
发表于 2012-3-27 20:43:52 | 显示全部楼层
回复 1# nieyiheng

这些是什么意思??你这个&和双引号是多余的.
""&$body1&"" ""&$body3&""

还有_IELinkClickByText($oIE,'"",1)Sleep (3000) 有问题,请仔细看看.
发表于 2012-3-27 23:49:40 | 显示全部楼层
把楼主的码写个高亮......
#include <IE.au3>
$file1 = FileOpen(@ProgramFilesDir& "\Internet Explorer\网址.txt", 0)
$file2 = FileOpen(@ProgramFilesDir& "\Internet Explorer\关键词.txt", 0)
$file3 = FileOpen(@ProgramFilesDir& "\Internet Explorer\链接.txt", 0)


While 1
$body1 = FileReadLine($file1)
$body2 = FileReadLine($file2)
$body3= FileReadLine($file3)
Local $oLinks = _IELinkGetCollection($body3)

if @error = -1 Then ExitLoop
#include <IE.au3>
$oie = _IECreate(""&$body1&"", 1)
$oForm = _IEFormGetObjByName ($oIE, "bdfm")
$oQuery = _IEFormElementGetObjByName ($oForm, "word")
_IEFormElementSetValue ($oQuery, ""&$body3&"")
$oQuery = _IEFormSubmit ($oForm, "0")
_IELinkClickByText($oIE,'"",1)Sleep (3000)
Sleep (1000)
;ProcessExists("IEXPLORE.exe") 
ProcessClose("IEXPLORE.exe")
WEnd
发表于 2012-3-27 23:53:10 | 显示全部楼层
测试了下,能运行啦。但是不知道是不是楼主要的效果
小弟真不懂IE
#include <IE.au3>
$file1 = FileOpen(@ProgramFilesDir& "\Internet Explorer\网址.txt", 0)
$file2 = FileOpen(@ProgramFilesDir& "\Internet Explorer\关键词.txt", 0)
$file3 = FileOpen(@ProgramFilesDir& "\Internet Explorer\链接.txt", 0)
 
 
While 1
$body1 = FileReadLine($file1)
$body2 = FileReadLine($file2)
$body3= FileReadLine($file3)
Local $oLinks = _IELinkGetCollection($body3)
 
if @error = -1 Then ExitLoop
#include <IE.au3>
$oie = _IECreate(""&$body1&"", 1)
$oForm = _IEFormGetObjByName ($oIE, "bdfm")
$oQuery = _IEFormElementGetObjByName ($oForm, "word")
_IEFormElementSetValue ($oQuery, ""&$body3&"")
$oQuery = _IEFormSubmit ($oForm, "0")
_IELinkClickByText($oIE,"",1)
Sleep (3000)
Sleep (1000)
;ProcessExists("IEXPLORE.exe") 
ProcessClose("IEXPLORE.exe")
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2012-3-29 09:05:31 | 显示全部楼层
非常感谢大家的回答。尤其是魔导。我还想问: au3如何清除 ie的cookies,我关闭ie后,怎么老是有文件删不掉呢?还有就是au3怎么把txt文件逐行打乱。例如:
内容:
11
22
33
随机打乱
33
11
22
发表于 2012-3-29 09:09:40 | 显示全部楼层
#include <IE.au3>
$file1 = FileOpen(@ProgramFilesDir& "\Internet Explorer\网址.txt", 0)
$file2 = FileOpen(@ProgramFilesDir& "\Internet Explorer\关键词.txt", 0)
$file3 = FileOpen(@ProgramFilesDir& "\Internet Explorer\链接.txt", 0)


While 1
$body1 = FileReadLine($file1)
$body2 = FileReadLine($file2)
$body3= FileReadLine($file3)
Local $oLinks = _IELinkGetCollection($body3)

if @error = -1 Then ExitLoop
#include <IE.au3>
$oie = _IECreate(""&$body1&"", 1)
$oForm = _IEFormGetObjByName ($oIE, "bdfm")
$oQuery = _IEFormElementGetObjByName ($oForm, "word")
_IEFormElementSetValue ($oQuery, ""&$body3&"")
$oQuery = _IEFormSubmit ($oForm, "0")
_IELinkClickByText($oie,"",1)
Sleep (3000)
;ProcessExists("IEXPLORE.exe") 
ProcessClose("IEXPLORE.exe")
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2012-3-30 08:17:06 | 显示全部楼层
谢谢大家  明白了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 17:35 , Processed in 0.097194 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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