luizeti Posted August 14, 2011 Share Posted August 14, 2011 HelloI need to get all link (http).takes only one linkGoogle TranslateGlobal $Gui,$busca='',$ok,$output='',$line $Gui = GUICreate("Google", 615, 438, 195, 114) $busca = GUICtrlCreateInput("", 18, 24, 513, 21) $ok = GUICtrlCreateButton("OK", 538, 22, 59, 25) $output = GUICtrlCreateEdit("", 16, 56, 585, 369) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $ok Local $sData = BinaryToString( InetRead("http://www.google.com.br/search?q="&GUICtrlRead($busca)&"&start=0&sa=n")) $array = StringRegExp($sData, '(?i)(?s).*<ol>(.*)</ol>', 1) ;~ expression get link helps --------------------------------------------------------------------------------------- $arrayE = StringRegExp($array[UBound($array) - 1], '(?i)http://(.*?)"', 1) ;~ expression get link helps --------------------------------------------------------------------------------------- for $i = 0 to UBound($arrayE) - 1 GUICtrlSetData($output, GUICtrlRead($output) & @CRLF & @CRLF &" "& $arrayE[$i]) Next EndSwitch WEnd Link to comment Share on other sites More sharing options...
Malkey Posted August 14, 2011 Share Posted August 14, 2011 Hello I need to get all link (http). takes only one link .... Sounds like the wrong flag parameter. #include <Array.au3> Local $str = "a b c d a b c d a b c d a b c d" Local $array = StringRegExp($str, "(a b)", 1) _ArrayDisplay($array, "Flag = 1") $array = StringRegExp($str, "(a b)", 2) _ArrayDisplay($array, "Flag = 2") $array = StringRegExp($str, "(a b)", 3) _ArrayDisplay($array, "Flag = 3") $array = StringRegExp($str, "(a b)", 4) _ArrayDisplay($array, "Flag = 4 ") For $i = 0 To UBound($array) - 1 _ArrayDisplay($array[$i], "Flag = 4 " & "$array[" & $i & "]") Next You need Flag = 3, global. Link to comment Share on other sites More sharing options...
luizeti Posted August 14, 2011 Author Share Posted August 14, 2011 (edited) Tranks.. Global $Gui,$busca='',$ok,$output='',$line $Gui = GUICreate("Google", 615, 438, 195, 114) $busca = GUICtrlCreateInput("", 18, 24, 513, 21) $ok = GUICtrlCreateButton("OK", 538, 22, 59, 25) $output = GUICtrlCreateEdit("", 16, 56, 585, 369) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $ok Local $sData = BinaryToString( InetRead("http://www.google.com.br/search?q="&GUICtrlRead($busca)&"&start=0&sa=n")) $array = StringRegExp($sData, '(?i)(?s).*<ol>(.*)</ol>', 1) $arrayE = StringRegExp($array[UBound($array) - 1], '(?i)http://(.*?)"', 3) for $i = 0 to UBound($arrayE) - 1 if( StringRegExp($arrayE[$i], 'google', 0) == 0 )Then GUICtrlSetData($output, GUICtrlRead($output) & @CRLF & @CRLF &" "& $arrayE[$i]) EndIf Next EndSwitch WEnd Edited August 15, 2011 by luizeti Link to comment Share on other sites More sharing options...
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