angelink 发表于 2010-9-20 21:13:25

如何让这个IE跳转只跳转一次?

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后在接着执行

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

angelink 发表于 2010-10-10 23:46:09

回复 2# lixiaolong


    谢谢提供,这个很好。

liufenglg 发表于 2010-10-11 15:30:53

想法不错。
页: [1]
查看完整版本: 如何让这个IE跳转只跳转一次?