|
悬赏1金钱未解决
要求用hao123打开不要出现新窗口
#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 |
|