劫持IE,IE自动跳转
想写个劫持IE,IE自动跳转不自动哪里错了,请大侠帮忙#include<IE.au3>Opt("MustDeclareVars",1)
;au3监控IE地址栏网址自动路转
Global $ConfigFile = @ScriptDir & "\urltz.ini"
Global $CurrentURL,$SourceUrls,$TargetURL
Global $DefaultTargetURL = " http://www.hao123.com"
Dim $MyVersion = "au3urltz"
If WinExists($MyVersion) Then Exit
AutoItWinSetTitle($MyVersion)
HotKeySet("#{F9}","_Exit") ;设置全局快捷键(Windows徽标键+F9退出程序)
$SourceUrls = IniReadSection($ConfigFile,"SourceURL")
$TargetURL = IniRead($ConfigFile,"TargetURL","TargetURL",$DefaultTargetURL)
While 1
Sleep(300)
;;;=======================================================
;;;得到所有IE窗口
Dim $IE_Objects,$i = 1,$n,$x, $oIE
$IE_Objects = 0
While 1
$oIE = _IEAttach ("", "instance", $i)
If @error = $_IEStatus_NoMatch Then ExitLoop
ReDim $IE_Objects[$i + 1]
$IE_Objects[$i] = $oIE
$IE_Objects = $i
$i += 1
WEnd
;MsgBox(0,"",$IE_Objects)
;;;========================================================
For $n=1 To $IE_Objects
$CurrentURL = _IEPropertyGet($IE_Objects[$n],"locationurl")
;MsgBox(0,"",$CurrentURL)
For $x = 1 To $SourceUrls
If $CurrentURL=$SourceUrls[$x] or $CurrentURL=$SourceUrls[$x] & "/" Then _IENavigate($IE_Objects[$n],$TargetURL)
Next
Next
WEnd
Func _Exit()
Exit
EndFunc 你要这个干吗,做广告吗? 没看明白,正好学习一下 期待大师出现,我好学习学习!
页:
[1]