找回密码
 加入
搜索
查看: 3159|回复: 9

[IE类操作] 请问如何判断ie地址栏中含有特定的字符?【已解决】

  [复制链接]
发表于 2011-5-17 18:41:21 | 显示全部楼层 |阅读模式
本帖最后由 p5200151 于 2011-5-19 16:24 编辑

如何判断ie地址栏中含是否有特定的字符,没有则替换进行跳转?
 楼主| 发表于 2011-5-17 18:42:36 | 显示全部楼层
用了主页插件,导致首页始终在两个网址中跳来跳去,没办法
发表于 2011-5-17 19:02:55 | 显示全部楼层
先打开任意一个贴子,然后运行下面代码.
如果是你需要的效果,那么自己改代码吧.

;
#include <IE.au3>
$oIE  = _IEAttach("http://www.autoitx.com/thread", "url")
$sURL = StringRegExpReplace($oIE.document.url, '.*?(-\d+-\d+-\d+).html', 'http://www.autoitx.com/thread-23239-1-1.html')
_IENavigate($oIE, $sURL)
Exit
 楼主| 发表于 2011-5-17 19:28:10 | 显示全部楼层
无效。。。。。。。。。。
发表于 2011-5-18 19:32:38 | 显示全部楼层
给你个吧。。。 我刚做好的。 你真会挑时候。
Global $Hk0="http://www.baidu.com/" , $Hk1="http://www.sogou.com/", $Hk2="http://www.gougou.com/",$Hk3="http://www.soso.com/",$Hk4="http://cn.bing.com/",$Hk5="http://58.ieeie.com/so3.html",$Hk6="about:Tabs",$Hk7="about:blank",$Hk8="http://hao123.com/",$Hk9="http://www.hao123.com/"
Global $HomePageURL="http://58.ieeie.com/sogou.aspx?u=lanfenglovec"
While 1
        LockHomePage()
        Sleep(100)
WEnd

Func LockHomePage()
        If ProcessExists("iexplore.exe") Then 
                $GoToUrl=ControlGetText("[CLASS:IEFrame]","","Edit1")
                If Not(StringCompare($GoToUrl,$Hk0) And StringCompare($GoToUrl,$Hk1) And StringCompare($GoToUrl,$Hk2) And StringCompare($GoToUrl,$Hk3) And StringCompare($GoToUrl,$Hk4) And StringCompare($GoToUrl,$Hk5) And StringCompare($GoToUrl,$Hk6) And StringCompare($GoToUrl,$Hk7) And StringCompare($GoToUrl,$Hk8) And StringCompare($GoToUrl,$Hk9)) Then
                        ControlSetText("[CLASS:IEFrame]","","Edit1",$HomePageURL)
                        Sleep(200)
                        ControlSend("[CLASS:IEFrame]","","Edit1","{ENTER}")
                        Sleep(200)
                EndIf
        EndIf
EndFunc
发表于 2011-5-18 19:49:46 | 显示全部楼层
楼上的,你太牛了~~呵呵。我试了,效果扛扛的。。
发表于 2011-5-18 19:55:57 | 显示全部楼层
我也试一下把代码补全
;
#include <IE.au3>
AutoItSetOption("TrayIconHide", 1)
Local $sURL =         _
                                "http://www.autoitx.com.Are you understand?" & @CRLF & _
                                "http://www.autoitx.com" & @CRLF & _
                                "http://www.baidu.com" & @CRLF & _
                                "http://www.163.com" & @CRLF & _
                                "http://www.126.com" & @CRLF & _
                                "http://www.sina.com" & @CRLF & _
                                "http://www.sohu.com"
Local $asURL = StringRegExp($sURL, '[^\r\n]+', 3)
While 1
        If ProcessExists("IEXPLORE.EXE") Then
                For $i = 0 To UBound($asURL) - 1 Step 1
                        Sleep(100)
                        $oIE  = _IEAttach($asURL[$i], "url")
                        If @error Then ContinueLoop
                        _IENavigate($oIE, "365.121dvd.com")
                Next
        EndIf
WEnd
Exit
 楼主| 发表于 2011-5-19 16:23:45 | 显示全部楼层
受益匪浅。。。。。。
 楼主| 发表于 2011-5-19 22:29:23 | 显示全部楼层
这脚本好像吃cpu厉害
发表于 2011-9-17 15:14:02 | 显示全部楼层
我看到的也是个时候 谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-27 07:32 , Processed in 0.074739 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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