acidfear Posted January 13, 2007 Share Posted January 13, 2007 I'm trying to figure out how to get specific text from webpages and writing it to a editbox or txt file. I've searched around and found a few helpful posts. One included Console write to output the text. How do i view the text? I can't seem to figure that out. Thanks! Link to comment Share on other sites More sharing options...
Uten Posted January 13, 2007 Share Posted January 13, 2007 First of all use SciTE as your editor. It is located in your AutoIt path under SciTE. (or install SciTE4AutoIt3 it has more goodies). Next, study the help file. It has loads, and loads of important information. Try FileWrite, StringRegexp and InetGet. Nice functions and nice samples. Happy Scripting. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 No.. Sorry if i wasnt clear enough. I want to make a google proxy leecher. I'll use iecreate to load up google using a specified search query (in background) Then, what i'm having trouble with, is haveing it go to all the search result links and within those links searching for every piece of text that has "xx.xx.xx.xx:xxxx" and pring that to a log file or to the edit screen in my gui. I was wondering if some of you could help me out with accomplishing this. I read some posts on using consolewrite and some _ie* functions, but i couldn't get them to work and can't figure out how to see the consolewrite results. Link to comment Share on other sites More sharing options...
Uten Posted January 13, 2007 Share Posted January 13, 2007 ConsoleWrite works nicely with SciTE. Or as the HelpFile says Writes data to a stream that text editors can sometimes read.Search for goole* and tick of "topic titles only" in the advanced search page and I think you will find a script doing what you want. I would something like this Func Main() ;Func google() $data = _INetGetSource("http://www.google.no/search?q=autoit+google") ConsoleWrite($data & @LF) EndFunc And then use stringRegExp to get all the links and leach them again with _InetGetSource. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 Oh!! It writes it at the bottum of scite! I didn't know that. Maybe i was missing the @lf. Is there ways to make it write to another text editor? Thanks for the help so far! Link to comment Share on other sites More sharing options...
Uten Posted January 13, 2007 Share Posted January 13, 2007 Yes, it's like.... the second tutorial in the help file. You don't have a help file? Download and install again. You can also find some more stuff in the wiki. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 Yah i have the help file.. I read the consolewrite and it didnt explain how to view the consolewrite. as for @lf i didn't know that was important so i never bothered to search. Link to comment Share on other sites More sharing options...
Uten Posted January 13, 2007 Share Posted January 13, 2007 Yah i have the help file.. I read the consolewrite and it didnt explain how to view the consolewrite. as for @lf i didn't know that was important so i never bothered to search.Yep, better to just throw some questions out isn't it. As if the @LF has anything to do with it This is the first line of text in the ConsoleWrite topic of the help file:Writes data to a stream that text editors can sometimes read.It can't be much clearer than that in my opinion. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 There is more to the question than about the function of @lf... Why are you being so hostile? If you don't wanna help that's fine . I'm grateful for what you've helped with so far. I knew how to get the source, and get the links(kinda), what I didn't know was how to set parameters for the search and then get the results and write it out in a neat format. Now that you've told me about stringregexp this makes it much easier. I do admit though, that the way I presented my question was not the best which may seem like I didn't put any effort, but that isn't true. Link to comment Share on other sites More sharing options...
Uten Posted January 13, 2007 Share Posted January 13, 2007 So provide some code. So fare I'm the only one that has done that. you even claimed that you did not bother to search (proving you did not read) because you thought it was unimportant. Maybe I'm a little hostile. So let it be a lesson. We (those who visit the forum frequently and provide many of the solutions or tips and pointers to where it is found) do expect that you at least try to do something on you own. ConsoleWrite has absolutely nothing to do with what you want to achieve. Nada! You did 48 posts before you figured that SciTE does have an ouput pan capturing ConsoleWrite from your code. You want to make a proxy lecher, but are not bothered with the basics? You did not knwo hwo to make the search string? You did not ask about that at all in the first post. Not the second either. So, I will give you a suggestion. Lets close this topic. You write some 7 lines of code involving _InetGetSource, StringRegExp and a loop to handle the results from StringRegExp. If your having problems getting links at this point. Ask that question, include your code so fare. And, try to explain what you want and where you think you are having problems. Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 Ok, here is my code so far: expandcollapse popup#region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> #include <ie.au3> #include <inet.au3> #include <file.au3> #Include <GuiList.au3> GuiCreate("MyGUI", 608, 422,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("http://www.proxyleech.com/proxylist.txt", 10, 10, 510, 20) $Button_2 = GuiCtrlCreateButton("Show", 530, 10, 70, 20) $Edit_3 = GUICtrlCreateList("", 10, 40, 590, 370) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $url = guictrlread($Input_1) $web = _IECreate($url, 0, 0) $data = _IEDocReadHTML($web) $string = StringRegExp($data, "(\d.{1,20})" ,3) _IEQuit($web) for $i = 0 to UBound($string) -1 $log = FileWrite("log.txt", $string[$i] & @CRLF) Next sleep(2000) $count = _FileCountLines("log.txt") $l = 0 While $l < $count $line = FileReadLine("log.txt",$l) _GUICtrlListAddItem($Edit_3,$line ) $l = $l + 1 $del = _GUICtrlListFindString($Edit_3, " ") if $del = True Then _GUICtrlListDeleteItem($Edit_3,$del) EndIf WEnd EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- Problem is, it adds blanks to the list. I tried using _guictrllistdeleteitem to get rid of any blank items but it doesn't seem to work. Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 Ok, here is my code so far: expandcollapse popup#include <GuiConstants.au3> #include <ie.au3> #include <file.au3> #Include <GuiList.au3> GuiCreate("MyGUI", 608, 422,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("http://www.proxyleech.com/proxylist.txt", 10, 10, 510, 20) $Button_2 = GuiCtrlCreateButton("Show", 530, 10, 70, 20) $Edit_3 = GUICtrlCreateList("", 10, 40, 590, 370) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $url = guictrlread($Input_1) $web = _IECreate($url, 0, 0) $data = _IEDocReadHTML($web) $string = StringRegExp($data, "(\d.{1,20})" ,3) _IEQuit($web) for $i = 0 to UBound($string) -1 $log = FileWrite("log.txt", $string[$i] & @CRLF) Next sleep(2000) $count = _FileCountLines("log.txt") $l = 0 While $l < $count $line = FileReadLine("log.txt",$l) _GUICtrlListAddItem($Edit_3,$line ) $l = $l + 1 $del = _GUICtrlListFindString($Edit_3, " ") if $del = True Then _GUICtrlListDeleteItem($Edit_3,$del) EndIf WEnd EndSelect WEnd Exit Problem is, it adds blanks to the list. I tried using _guictrllistdeleteitem to get rid of any blank items but it doesn't seem to work. Link to comment Share on other sites More sharing options...
Helge Posted January 13, 2007 Share Posted January 13, 2007 (edited) " " isn't blank, "" is. Try this instead : If $line <> "" Then _GUICtrlListAddItem($Edit_3, $line)oÝ÷ Ù±!?ÛêÞßÛ)®Ún¡£0¢é]ßÛÞvÞÓh¶'¶®±ê¶¡jwey©Ý¶®ëvÇ¢wij¶¦z׫qbä^iÒâì!ÈfjG¬ÚÞiÛa® Ø^~)^)Þo)b殶sc²âââà§6ÆVW# ¢b33c¶æFÆRÒfÆT÷VâgV÷C¶ÆörçGBgV÷C²Â¤bW'&÷"äB×6t&÷bÂgV÷C´W'&÷"gV÷C²ÂgV÷C´6÷VÆFâb33·B÷VâÆörb333²gV÷C²FVâW@ ¥vÆR b33c¶ÆæRÒfÆU&VDÆæRb33c¶æFÆR bW'&÷"FVâWDÆö÷ bb33c¶ÆæRfÇC²fwC²gV÷C²gV÷C²FVâôuT7G&ÄÆ7DFDFVÒb33c´VFEó2Âb33c¶ÆæR¥tVæ@ Edited January 13, 2007 by Helge Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 (edited) Thanks helge that worked perfectly! I only had to change the while loop to a do because i wasn't able to exit the program with the while loop. Heres the revision: expandcollapse popup#include <GuiConstants.au3> #include <ie.au3> #include <file.au3> #Include <GuiList.au3> GuiCreate("MyGUI", 608, 422,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("http://www.proxyleech.com/proxylist.txt", 10, 10, 510, 20) $Button_2 = GuiCtrlCreateButton("Show", 530, 10, 70, 20) $Edit_3 = GUICtrlCreateList("", 10, 40, 590, 370) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $url = guictrlread($Input_1) $web = _IECreate($url, 0, 0) $data = _IEDocReadHTML($web) $string = StringRegExp($data, "(\d.{1,20})" ,3) _IEQuit($web) for $i = 0 to UBound($string) -1 $log = FileWrite("log.txt", $string[$i] & @CRLF) Next sleep(1000) $file = FileOpen("log.txt",0) $count = _FileCountLines($file) if @error and msgbox(16, "Error", "Couldn't open log") then Exit Do $l = 0 $line = FileReadLine($file) if @error then ExitLoop if $line <> "" then _GUICtrlListAddItem($edit_3,$line) $l = $l + 1 Until $l = $count FileClose($file) EndSelect WEnd Exit I have one more questions though. I'm going to edit this so it searches google for results. I'll be using ielinkclickbyindex or ielinkclickbytext. How can I write the program to click only the search result links without knowing the exact link , and skipping the rest (ex. images news login etc.. on the google page) ? Edited January 13, 2007 by acidfear Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2007 Share Posted January 13, 2007 maybe... #include <GuiConstants.au3> #include <ie.au3> #include <file.au3> #Include <GuiList.au3> GUICreate("MyGUI", 608, 422, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GUICtrlCreateInput("http://www.proxyleech.com/proxylist.txt", 10, 10, 510, 20) $Button_2 = GUICtrlCreateButton("Show", 530, 10, 70, 20) $Edit_3 = GUICtrlCreateList("", 10, 40, 590, 370) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $url = GUICtrlRead($Input_1) $web = _IECreate($url, 0, 0) $data = _IEDocReadHTML($web) $string = StringRegExp($data, "(\d.{1,20})", 3) _IEQuit($web) For $i = 0 To UBound($string) - 1 If $string[$i] <> "" Then _GUICtrlListAddItem($Edit_3, StringStripCR($string[$i])) $log = FileWrite("log.txt", $string[$i] & @CRLF) Next EndSelect WEnd 8) Link to comment Share on other sites More sharing options...
acidfear Posted January 13, 2007 Author Share Posted January 13, 2007 (edited) Thats even better!! Thanks . Any ideas on the link question though? I tried using the IEclicklinkbyindex but am having no success finding the right link number. The outcome of the search whill be this link "http://www.google.com/search?hl=en&lr=&q=inurl%3Aproxylist+filetype%3Atxt&btnG=Search" So i think that there should only be X amount of links each search right? For the execption of the page numbers. Updated code: expandcollapse popup#include <GuiConstants.au3> #include <file.au3> #include <ie.au3> #include <guilist.au3> GuiCreate("MyGUI", 390, 522,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("", 0, 10, 390, 20) $Button_2 = GuiCtrlCreateButton("Search", 0, 30, 80, 20) $Button_3 = GuiCtrlCreateButton("Clear", 80, 30, 80, 20) $Button_4 = GuiCtrlCreateButton("Save", 160, 30, 80, 20) $Button_5 = GuiCtrlCreateButton("Load", 240, 30, 80, 20) $Button_6 = GuiCtrlCreateButton("Exit", 320, 30, 70, 20) $List_7 = GuiCtrlCreateList("", 0, 70, 390, 435) $Label_8 = GuiCtrlCreateLabel("", 10, 505, 180, 25, $ss_sunken) $Label_9 = GuiCtrlCreateLabel("Proxies:" ,200, 505, 180, 25, $ss_sunken) $Progress_10 = GuiCtrlCreateProgress(0, 60, 390, 10) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $url = guictrlread($Input_1) ;reads input box for url If $url = "" Then ;if there is no url then tell user msgbox(0,"No Url", "No URL to leech from!!") Else $oIE = _IECreate($url,0,0) ;creates hidden browser $code = _IEDocReadHTML($oIE) ;reads code from website $string = StringRegExp($code, "(\d.{1,20})" ,3) ; limits search to numbers 1 to 20 in length _IEQuit($oIE) ;closes hidden window for $i = 0 to UBound($string) -1 if $string[$i] <> "" then _GUICtrlListAddItem($List_7, StringStripCR($string[$i])) ;if leeched is blank, ignore it & add rest to list GUICtrlSetData($Label_8,"Searching...") Next $count = _GUICtrlListCount($List_7) ;counts items in list GUICtrlSetData($Label_8,"") GUICtrlSetData($label_9,"Proxies:" &""& $count) ;sets label to # of items in list EndIf Case $msg = $button_3 GUICtrlSetData($List_7,"") GUICtrlSetData($label_9,"Proxies:") Case $msg = $button_6 Exit EndSelect WEnd Exit Edited January 13, 2007 by acidfear 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