[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
转载自zqz0012005的博客
  1. '防止Google对搜索结果重定向
  2. On Error Resume Next
  3. Set sh = CreateObject("Shell.Application")
  4. do
  5.     RemoveGoogleRedirect
  6.     WScript.sleep 1000*3
  7. loop
  8. function RemoveGoogleRedirect()
  9.   Dim wnds, wnd, document, el, sc
  10.   Set wnds = sh.Windows()
  11.   For Each wnd In wnds
  12.     if InStr(1,wnd.LocationURL,"http://www.google.com.hk",1) then
  13.         set document = wnd.document
  14.         if document.readyState="complete" then
  15.             set el = Nothing
  16.             set el = document.getElementById("RemoveGoogleRedirect")
  17.             if el Is Nothing then
  18.                 set sc = document.createElement("script")
  19.                 sc.id = "RemoveGoogleRedirect"
  20.                 sc.text = "function rwt(){return true;}"
  21.                 document.body.appendChild(sc)
  22.             end if
  23.         end if
  24.     End If
  25.   Next
  26. end function
复制代码

TOP

MSDN
Windows Method
--------------------------------------------------------------------------------
Creates and returns a ShellWindows object. This object represents a collection of all of the open windows that belong to the Shell.

如果explorer.exe进程被结束过,原来打开的ie窗口就获取不到了。像我经常干这种事,所以很多ie窗口访问不了,郁闷,找不到一个更好的方法。

TOP

返回列表