|
本帖最后由 yang3114 于 2010-11-1 17:08 编辑
#include <IE.au3>
_IEErrorHandlerRegister()
Global $oIE = _IECreateEmbedded()
$url = "http://www.hao123.com"
GUICreate("test", 700, 600, (@DesktopWidth - 700) / 2, (@DesktopHeight - 600) / 2)
GUICtrlCreateObj($oIE, 0, 0, 700, 600)
_IENavigate($oIE, $url)
_replace()
GUISetState()
Do
$nurl = _IEPropertyGet($oIE, "locationurl")
If $nurl <> $url Then
_replace()
$url = $nurl
EndIf
Sleep(10)
Until GUIGetMsg() = -3
Func _replace()
Local $body, $string
_IELoadWait($oIE)
$body = _IEBodyReadHTML($oIE)
$string = StringRegExpReplace($body, '\btarget=_blank', 'target=_self')
$string = StringRegExpReplace($string, '\btarget="_blank"', 'target=_self')
_IEBodyWriteHTML($oIE, $string)
EndFunc ;==>_replace |
|