nieyiheng 发表于 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&"出粗了。怎么回事呢?

shqf 发表于 2012-3-27 20:41:47

<IE.au3>怎么include了两次?""&$body1&""、""&$body3&""两个变量前后加空字串什么意思啊?看不明白。

lixiaolong 发表于 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

nieyiheng 发表于 2012-3-29 09:05:31

非常感谢大家的回答。尤其是魔导。我还想问: au3如何清除 ie的cookies,我关闭ie后,怎么老是有文件删不掉呢?还有就是au3怎么把txt文件逐行打乱。例如:
内容:
11
22
33
随机打乱
33
11
22

redapple2008 发表于 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

nieyiheng 发表于 2012-3-30 08:17:06

谢谢大家明白了!
页: [1]
查看完整版本: 这变量怎么不行呢