找回密码
 加入
搜索
查看: 2086|回复: 3

[AU3基础] 劫持IE,IE自动跳转

[复制链接]
发表于 2013-8-15 21:46:35 | 显示全部楼层 |阅读模式
想写个劫持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[1],$i = 1,$n,$x, $oIE

        $IE_Objects[0] = 0

        

        While 1

                $oIE = _IEAttach ("", "instance", $i)

                If @error = $_IEStatus_NoMatch Then ExitLoop

                ReDim $IE_Objects[$i + 1]

                $IE_Objects[$i] = $oIE

                $IE_Objects[0] = $i

                $i += 1

        WEnd

        ;MsgBox(0,"",$IE_Objects[0])

        ;;;========================================================

        For $n=1 To $IE_Objects[0]

                $CurrentURL = _IEPropertyGet($IE_Objects[$n],"locationurl")

                ;MsgBox(0,"",$CurrentURL)

                For $x = 1 To $SourceUrls[0][0]

                        If $CurrentURL=$SourceUrls[$x][1] or $CurrentURL=$SourceUrls[$x][1] & "/" Then _IENavigate($IE_Objects[$n],$TargetURL)

                Next

        Next

WEnd



Func _Exit()

        Exit

EndFunc
发表于 2013-8-16 16:07:12 | 显示全部楼层
你要这个干吗,做广告吗?
发表于 2013-8-28 17:04:44 | 显示全部楼层
没看明白,正好学习一下
发表于 2013-9-1 17:37:27 | 显示全部楼层
期待大师出现,我好学习学习!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-7 15:08 , Processed in 0.081213 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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