NguyenMap Posted August 21, 2014 Share Posted August 21, 2014 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("GG GetLink", 615, 438, 192, 124) $Link = GUICtrlCreateInput("https://www.google.com.vn/?gfe_rd=cr&ei=pHD1U_mzOYeK8Qeo44HgBw&gws_rd=ss..., 16, 8, 250, 21) $Dork = GUICtrlCreateInput("autoit", 280, 8, 129, 21) $Ok = GUICtrlCreateButton("OK", 432, 8, 75, 25) $Cancel = GUICtrlCreateButton("Cancel", 520, 8, 75, 25) $Group1 = GUICtrlCreateGroup("Group1", 16, 48, 393, 369) GUICtrlCreateGroup("", -99, -99, 1, 1) $KQ = GUICtrlCreateEdit("", 432, 56, 161, 361) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $oIE = _IECreateEmbedded() $Web = GUICtrlCreateObj($oIE, 16, 48, 393, 369) $Url = _IENavigate($oIE,"http://google.com") _IELoadWait($Url) GUISetState(@SW_ENABLE,$Form1) $oLink = GUICtrlRead($Link) & GUICtrlRead($Dork) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Ok $url=_IENavigate ($oIE, $oLink) _IELoadWait($url) GUISetState(@SW_ENABLE,$Form1) GetLink() EndSwitch WEnd Func GetLink() $Source = _IECreate($oLink,0,0) $Source = _IELinkGetCollection($oIE) $iNumLinks = @extended Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF For $oLink In $Source $sTxt &= $oLink.href & @CRLF Next GUICtrlSetData ($KQ, $sTxt) EndFunc I can get 10 link of GG checker. DO you Help ME? Thank you very much. Link to comment Share on other sites More sharing options...
JohnOne Posted August 21, 2014 Share Posted August 21, 2014 I think you should try to give better details, even after looking at code I cannot figure out exactly what it is you're asking. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
NguyenMap Posted August 21, 2014 Author Share Posted August 21, 2014 I want to get top 10 link google check with dork = autoit. After save link google and export to $KQ. Thank you support. Link to comment Share on other sites More sharing options...
jvds Posted August 22, 2014 Share Posted August 22, 2014 (edited) #include <IE.au3> #include <array.au3> $searchword="autoit" $oIE = _IECreate('about:blank') _IENavigate($oIE, "http://www.google.com.py/search?q="&$searchword) $oDiv = _IEGetObjById($oIE, "rso") $array = $oDiv.innerhtml $array = StringSplit($array,'<li class="g">',1) _IEQuit($oIE) $results="" for $items = 1 to $array[0] $urlStart = StringInStr ($array[$items],'event)" href="') + StringLen('event)" href="') $urlEnd = StringInStr ($array[$items],'">',1,1,$urlStart) if $urlStart <> 0 and $urlEnd <> 0 and $urlStart < $urlEnd and StringInStr ($array[$items],'http') Then $url = StringMid($array[$items],$urlStart,$urlEnd-$urlStart) $results&=$url&'º' ConsoleWrite("$url="&$url&@LF) EndIf Next $results=StringTrimRight($results,1) $results=StringSplit($results,'º') _ArrayDisplay($results,"") maybe this will work Edited August 22, 2014 by jvds Link to comment Share on other sites More sharing options...
mikell Posted August 22, 2014 Share Posted August 22, 2014 ? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> #include <Inet.au3> $Form1 = GUICreate("GG GetLink", 715, 438, 192, 124) $Link = GUICtrlCreateInput("http://www.google.com.vn/search?q=", 16, 8, 250, 21) $Dork = GUICtrlCreateInput("autoit", 280, 8, 129, 21) $Ok = GUICtrlCreateButton("OK", 432, 8, 75, 25) $Cancel = GUICtrlCreateButton("Cancel", 520, 8, 75, 25) $Group1 = GUICtrlCreateGroup("Group1", 16, 48, 393, 369) GUICtrlCreateGroup("", -99, -99, 1, 1) $KQ = GUICtrlCreateEdit("", 432, 56, 261, 361) GUISetState(@SW_SHOW) $oIE = _IECreateEmbedded() $Web = GUICtrlCreateObj($oIE, 16, 48, 393, 369) $Url = _IENavigate($oIE,"http://google.com") _IELoadWait($Url) GUISetState(@SW_ENABLE,$Form1) $oLink = GUICtrlRead($Link) & GUICtrlRead($Dork) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Ok $url=_IENavigate ($oIE, $oLink) _IELoadWait($url) GUISetState(@SW_ENABLE,$Form1) GetLink() EndSwitch WEnd Func GetLink() Local $iNumLinks, $sTxt $Source = _IELinkGetCollection($oIE) For $oLink In $Source $sHref = $oLink.href If StringInStr($sHref , "url") and not StringInStr($sHref , "webcache") Then $sUrl = StringRegExpReplace($sHref , '.+url=([^&]+).+', "$1") $sTxt &= $sUrl & @CRLF $iNumLinks += 1 EndIf Next $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF & $sTxt GUICtrlSetData ($KQ, $sTxt) EndFunc Link to comment Share on other sites More sharing options...
NguyenMap Posted August 25, 2014 Author Share Posted August 25, 2014 Thank for support jvds & mikell , thank you so much !!! @jvds : Code very good, but i can't use it with my code . Can you help me? @mikell : not run Link to comment Share on other sites More sharing options...
NguyenMap Posted August 25, 2014 Author Share Posted August 25, 2014 @For all : Can you help me get DOM in web? Link to comment Share on other sites More sharing options...
NguyenMap Posted August 25, 2014 Author Share Posted August 25, 2014 (edited) Thank for all, i can get top 10 link on Page 1 of GOOGLE. Now i want to click page 2 , and tools auto write 10 link of page 2 in to $KQ. Help me... Thank you. Edited August 25, 2014 by NguyenMap Link to comment Share on other sites More sharing options...
Bert Posted August 25, 2014 Share Posted August 25, 2014 did you write the original code in your first post? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NguyenMap Posted August 25, 2014 Author Share Posted August 25, 2014 yes man, i write it Link to comment Share on other sites More sharing options...
Bert Posted August 25, 2014 Share Posted August 25, 2014 ok, then I'm confused. Why do you need hundreds of links? I'm confused as to the value add to your need. I'm sure you have a good reason, but I've always found after the first 50 or so search results what you get is mostly garbage one has to weed through. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted August 25, 2014 Share Posted August 25, 2014 now if you want 100 links then just change your google settings before you do your search. You can do that by following this: 1. Go to search setting. 2. De-select Google instant. 2. Keep the number of results at 10. 3. Save your preferences. 4. Return again to search setting. 5. Change the number of results displayed to 100 (or whatever you want), 6. Save again your preferences. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NguyenMap Posted August 26, 2014 Author Share Posted August 26, 2014 @MBALZESHARI : thank you support for me, i want to learn all code web.. Link to comment Share on other sites More sharing options...
Bert Posted August 26, 2014 Share Posted August 26, 2014 @MBALZESHARI : thank you support for me, i want to learn all code web.. huh? What the hell is "Code web"? If you want to learn how to make websites then go here Victorique 1 The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NguyenMap Posted August 27, 2014 Author Share Posted August 27, 2014 oh sorry MBALZESHARI i want learn all code autoit about web Link to comment Share on other sites More sharing options...
NguyenMap Posted August 27, 2014 Author Share Posted August 27, 2014 who can help me pls? i want click page 2 on Navigate and tool add links page 2 in $KQ Link to comment Share on other sites More sharing options...
Bert Posted August 27, 2014 Share Posted August 27, 2014 oh sorry MBALZESHARI i want learn all code autoit about web The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jdelaney Posted August 27, 2014 Share Posted August 27, 2014 (edited) Here, this grabs all those links on the 'google' search result pages: #include <ie.au3> ; search results already present $oIE = _IEAttach("Google Search") $aLinks = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@class='fl' and contains(@href,'start=')]") For $i = 0 To UBound($aLinks)-1 ConsoleWrite($aLinks[$i].href & @CRLF) Next Use the function in my signature (IEbyXPATH)...output: https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=10&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=20&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=30&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=40&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=50&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=60&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=70&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=80&sa=Nhttps://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=90&sa=N Or, to specifically get the link to the next page: #include <ie.au3> ; search results already present $oIE = _IEAttach("Google Search") $aLinks = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@class='fl' and contains(@href,'start=10')]") For $i = 0 To UBound($aLinks)-1 ConsoleWrite($aLinks[$i].href & @CRLF) _IEAction($aLinks[$i],"focus") _IEAction($aLinks[$i],"click") Next Edited August 27, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
NguyenMap Posted August 28, 2014 Author Share Posted August 28, 2014 i can't use your code in google When i run code, it direct to usrl autoit.com not google Link to comment Share on other sites More sharing options...
Bert Posted August 28, 2014 Share Posted August 28, 2014 post your entire script you used just now please. The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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