Draygoes Posted August 28, 2014 Share Posted August 28, 2014 (edited) He is new. Its hard to word a question if you dont know exactly what you are asking for. who can help me pls? i want click page 2 on Navigate and tool add links page 2 in $KQ I am not sure that I am the right person to help you, but you can get a lot more help this way. Please place any .au3 files you have written in a zip file. Please upload that file here as an attachment. (Click "Full Editor" beside the post button below.) Also, please include the current version of Autoit you have installed. If you are not sure, then please download the latest version from the main site. Edited August 28, 2014 by Draygoes Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
NguyenMap Posted August 29, 2014 Author Share Posted August 29, 2014 (edited) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> #include <Inet.au3> #include <array.au3> #include <FF.au3> #include <String.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("GG GetLink", 615, 438, 192, 124) $Link = GUICtrlCreateInput("https://www.google.com.vn/search?num=1000&lr=lang_en&hl=vi&as_qdr=all&tb..., 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) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Ok $oLink = GUICtrlRead($Link) & GUICtrlRead($Dork) $url=_IENavigate ($oIE, $oLink) _IELoadWait($url) GUISetState(@SW_ENABLE,$Form1) GetLink() Case $Cancel _IEQuit EndSwitch WEnd Func GetLink() $Address = GUICtrlRead($Link) & GUICtrlRead($Dork) $source = _INetGetSource($Address) $source = _StringBetween($source,'<a href="/url?q=','&sa=U') $results = "" For $i = 0 to UBound($source) - 1 $link1 = StringReplace($source[$i],'%3D','=') $link = StringReplace($link1,'%3F','?') $results &= $link&@CRLF GUICtrlSetData ($KQ, $results) Next EndFunc Thank for support Draygoes , MBALZESHARI !!!! with code new, i can get link page 1 good, but now i want to click link page 2 in navigate and tool auto write link page 2 in to $KQ ( but no del link page 1) . Help me pls. Edited August 29, 2014 by NguyenMap Link to comment Share on other sites More sharing options...
mLipok Posted August 29, 2014 Share Posted August 29, 2014 @NguyenMap please read How to post code on the forum Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Bert Posted August 29, 2014 Share Posted August 29, 2014 @NguyenMap What is your native language? Vietnamese? Chinese? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NguyenMap Posted August 29, 2014 Author Share Posted August 29, 2014 yes man, i am Vietnamese. :} Link to comment Share on other sites More sharing options...
Bert Posted August 29, 2014 Share Posted August 29, 2014 post your responses in your language and we can translate. It may make things easier. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jvds Posted August 30, 2014 Share Posted August 30, 2014 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. so you don't what the top 10 links that the search result produces, you need the top 100??, or do you need all links? Link to comment Share on other sites More sharing options...
NguyenMap Posted August 30, 2014 Author Share Posted August 30, 2014 i need all link Link to comment Share on other sites More sharing options...
mikell Posted August 30, 2014 Share Posted August 30, 2014 Local $oSpans = _IETagNameGetCollection($oIE, "span") For $oSpan In $oSpans If $oSpan.innertext == "Tiếp" Then _IEAction($oSpan, "click") Next Link to comment Share on other sites More sharing options...
jdelaney Posted August 30, 2014 Share Posted August 30, 2014 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 So you want to do this...already have shown you how Draygoes 1 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...
Draygoes Posted August 31, 2014 Share Posted August 31, 2014 Agreed. I even tried to give you simple instructions on how to get more help. Please do what I recommended, and what others have instructed you to do. This is a wonderful community, but nobody can help if you refuse to follow the instructions given. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
aNewLyfe Posted August 31, 2014 Share Posted August 31, 2014 be carefull, your ip could be banned. google have a limit of queries per minute. happened to me before btw, if you just want the links why dont you try: $baselink = "https://www.google.com.vn/?gws_rd=ssl#" $search = "SEARCH+TEXT" for $i=0 to 100 step 10 $currentlink = $baselink&"q="&$search&"&start="&$i $source = _InetGetSource($currentlink) $eachlink = _StringBetween($source,'<a href="/url?q=','&sa=U') if isArray($eachlink) then for $z=0 to ubound($eachlink)-1 msgbox(0,"",$eachlink[$z]); next endif next ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
NguyenMap Posted August 31, 2014 Author Share Posted August 31, 2014 Thanks For All This is a wonderful community @ Draygoes : Ok, i will zip file au3 and attach file to forum @aNewLyfe : Code no run @jdelaney : i can't run code of you with google. I use and it run with URL "autoitscript.com". @mikell : what do you teach me ??? I can use it with my code? GG.rar Link to comment Share on other sites More sharing options...
aNewLyfe Posted August 31, 2014 Share Posted August 31, 2014 Thanks For All This is a wonderful community @ Draygoes : Ok, i will zip file au3 and attach file to forum @aNewLyfe : Code no run @jdelaney : i can't run code of you with google. I use and it run with URL "autoitscript.com". @mikell : what do you teach me ??? I can use it with my code? GG.rar This works: #include "inet.au3" #include "string.au3" $baselink = "https://www.google.com.vn/search?output=search&sclient=psy-ab" $search = "SEARCH+TEXT" for $i=0 to 100 step 10 $currentlink = $baselink&"&q="&$search&"&start="&$i $source = _InetGetSource($currentlink) $eachlink = _StringBetween($source,'<a href="/url?q=','&sa=U') if isArray($eachlink) then for $z=0 to ubound($eachlink)-1 If StringInStr($eachlink[$z], "://") Then msgbox(0,"",$eachlink[$z]) EndIf next endif next change msgbox(0,"",$eachlink[$z]) to whatever you want to do with links... ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
mikell Posted August 31, 2014 Share Posted August 31, 2014 aNewLyfe, May i suggest a big Sleep() inside the For loop ? Currently the msgbox brings a delay, but if you remove this blocking part then Google will fire you as a robot Link to comment Share on other sites More sharing options...
Bert Posted August 31, 2014 Share Posted August 31, 2014 (edited) Simple question - What are you going to do with this information once you get it? I know you WANT the links. I'm asking why you need it. Maybe someone else can answer why one would need this sort of thing. I want to educate myself here. Edited August 31, 2014 by MBALZESHARI The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Draygoes Posted September 1, 2014 Share Posted September 1, 2014 Simple question - What are you going to do with this information once you get it? I know you WANT the links. I'm asking why you need it. Maybe someone else can answer why one would need this sort of thing. I want to educate myself here. Practice? I really don't know. The program in question really doesn't have much of a use. @The OP, Why are you not responding? People are asking questions, because the answers will help them to help you. You have already gotten a decent solution, and a lot of advice. So at this point you need to start answering the questions. Also, what version of Autoit are you currently using? Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
jdelaney Posted September 2, 2014 Share Posted September 2, 2014 Thanks For All This is a wonderful community @ Draygoes : Ok, i will zip file au3 and attach file to forum @aNewLyfe : Code no run @jdelaney : i can't run code of you with google. I use and it run with URL "autoitscript.com". @mikell : what do you teach me ??? I can use it with my code? GG.rar Runs on autoitscript.com, because that's what the samples do. Just use the function, and vars, and remove the web crawling piece. 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...
aNewLyfe Posted September 2, 2014 Share Posted September 2, 2014 OFC I've already warned him about this. aNewLyfe, May i suggest a big Sleep() inside the For loop ? Currently the msgbox brings a delay, but if you remove this blocking part then Google will fire you as a robot ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
NguyenMap Posted September 3, 2014 Author Share Posted September 3, 2014 @Draygoes , @MBALZESHARI : i have my project, i don't say to here. I just want to learn from people. If you help me, pls thank you. @ For All : thank 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