AzKay Posted September 17, 2006 Posted September 17, 2006 expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("", 516, 555, 194, 116) $Group1 = GUICtrlCreateGroup("", 0, 488, 513, 65) $Input1 = GUICtrlCreateInput("", 8, 504, 241, 21) $Input2 = GUICtrlCreateInput("", 264, 504, 241, 21) $Button1 = GUICtrlCreateButton("Search", 8, 528, 497, 17) GUICtrlSetOnEvent(-1, "_Search") GUICtrlCreateGroup("", -99, -99, 1, 1) $Obj1 = ObjCreate("Shell.Explorer.2") $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, -96, 514, 580) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _Search() $Input1Read = GUICtrlRead($Input1) $Input2Read = GUICtrlRead($Input2) _IENavigate($Obj1, "http://www.google.be/search?hl=en&safe=off&q=" _ & $Input1Read & " site:" & $Input2Read & "&btnG=Search&meta=") $BodyRead = _IEBodyReadHTML($Obj1) $StringBetween = _StringBetween($BodyRead, "<html>", "Result Page:") ;Basically, its around here the problem. If the page doesnt have the $StringBetween, I want it to use the #StringBetween2. But I dont know how im to do this. Any ideas? If Not @error Then _IEBodyWriteHTML($Obj1, $StringBetween) Else $StringBetween1 = _StringBetween($BodyRead, "<html>", "In order to show") _IEBodyWriteHTML($Obj1, $StringBetween1) EndIf EndFunc Func _StringBetween($str, $start, $end) $pos = StringInStr($str, $start) If Not @error Then $str = StringTrimLeft($str, $pos + StringLen($start) - 1) $pos = StringInStr($str, $end) If Not @error Then $str = StringTrimRight($str, StringLen($str) - $pos + 1) Return $str EndIf EndIf EndFunc # MY LOVE FOR YOU... IS LIKE A TRUCK- #
NELyon Posted September 17, 2006 Posted September 17, 2006 I tried your code, and it works, but it only flashes the page for a few seconds. Is that what is happening to you?
AzKay Posted September 17, 2006 Author Posted September 17, 2006 Except, when mines meant to "write" it just writes blank. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now