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

[IE类操作] 如何让这个IE跳转只跳转一次?

[复制链接]
发表于 2010-9-20 21:13:25 | 显示全部楼层 |阅读模式
While 1
Sleep(400)
$oShell = ObjCreate('shell.application') 
$oShellWindows = $oShell.windows 
For $Window In $oShellWindows
If StringRight($Window.FullName, 12) = 'iexplore.exe' Then                        
If StringInStr($Window.locationurl,'www.baidu.com',2) Then $Window.navigate('http://www.google.com')
EndIf
Next
WEnd
代码执行后监控IE地址栏,第一次打开百度后跳转到谷哥,第二次在打开百度后就不跳转了。直到第二次打开ie后在接着执行
发表于 2010-9-22 18:38:10 | 显示全部楼层
回复 1# angelink

试试这个
$a = 0
While 1
        Sleep(400)
        $oShell = ObjCreate('shell.application')
        $oShellWindows = $oShell.windows

        If $a = 0 And ProcessExists("iexplore.exe") Then
                For $Window In $oShellWindows
                        If StringInStr($Window.locationurl, 'www.baidu.com', 2) Then
                                $Window.navigate('http://www.google.com')
                                $a = 1
                        EndIf
                Next
        ElseIf $a = 1 And ProcessExists("iexplore.exe") Then
                ContinueLoop
        Else
                $a = 0
                ContinueLoop
        EndIf
WEnd
 楼主| 发表于 2010-10-10 23:46:09 | 显示全部楼层
回复 2# lixiaolong


    谢谢提供,这个很好。
发表于 2010-10-11 15:30:53 | 显示全部楼层
想法不错。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 20:19 , Processed in 0.084770 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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