MaoMao Posted November 20, 2011 Share Posted November 20, 2011 HI, Try to make auto search in web site. Help need how to enter name and display result? Can anyone tell what's wrong with the codes? Tested some code did not work. #include <IE.au3> $oIE = _IECreate ("http://sourceforge.net") $oForm = _IEFormGetObjByName ($oIE, "mainform") $oText = _IEFormElementGetObjByName ($oForm, "words") ; Enter the search Object name "words" as search target i.e. FireFox _IEFormElementSetValue($oText, "FireFox") $oQuery = _IEFormElementGetObjByName ($oForm, "q") _IEFormElementSetValue ($oQuery, $oText ) _IEFormSubmit ($oForm) ; Display Result on an element with the number of downloads in Object name "Download" $oMarquee = _IEGetObjByName ($oIE, "Download") MsgBox(0, "SourceForge Information", $oMarquee) Link to comment Share on other sites More sharing options...
bogQ Posted November 20, 2011 Share Posted November 20, 2011 $oIE = _IECreate("http://sourceforge.net/") $oForm = _IEFormGetCollection ($oIE, 0) $oQuery = _IEFormElementGetCollection ($oForm, 0) _IEFormElementSetValue ($oQuery, "TESTING") TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
MaoMao Posted November 27, 2011 Author Share Posted November 27, 2011 Thanks! Got the fist part moving! Still got problem in retrieve the Download result and display the Download number. Please help how to get the first number of download result.????? #include <IE.au3> $oIE = _IECreate ("http://sourceforge.net/") ; Enter the search Object name "words" as search target i.e. FireFox $oForm = _IEFormGetCollection ($oIE, 0) $oQuery = _IEFormElementGetCollection ($oForm, 0) _IEFormElementSetValue ($oQuery, "FireFox") _IEFormSubmit ($oForm) ; Display Result on an element with the First number of downloads in Object name "Download" $oMarquee = _IEGetObjByName ($oIE, "Download") MsgBox(0, "SourceForge Information", $oMarquee) $oIE = _IECreate("http://sourceforge.net/") $oForm = _IEFormGetCollection ($oIE, 0) $oQuery = _IEFormElementGetCollection ($oForm, 0) _IEFormElementSetValue ($oQuery, "TESTING") Link to comment Share on other sites More sharing options...
bogQ Posted November 27, 2011 Share Posted November 27, 2011 (edited) i dont know what are you trying to get, maybe picture of a page where you mark the data that you need to pull and some additional info about what exactly your trying to do can help me to understand what data you need from that page one more thing, pls sustrain your self of pming members as soon as you post something new, no one here like that edit or maybe you need something like this? #include <String.au3> #include <Array.au3> $aArray1 = _StringBetween(StringReplace(BinaryToString(InetRead('http://sourceforge.net/search/?q='&'FireFox')),' ',''), 'timeline">', '</b>thisweek') _ArrayDisplay($aArray1, 'Default Search') Edited November 27, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
MaoMao Posted November 27, 2011 Author Share Posted November 27, 2011 Thank you very much for the detail reply and nice sample code. Sorry for the inconvenience caused. The Array and String are very complicated good example. It move many steps ahead.By the way, in my coding how to simply get only the first download number i.e. 176,233 this weekwhat should be modify in the code to store the number and display in a message box?Appreciate your help and nice quick reply. Link to comment Share on other sites More sharing options...
bogQ Posted November 27, 2011 Share Posted November 27, 2011 (edited) $aArray1[0] will hold first data if you neede some other data you pull them with $aArray1[1] or $aArray1[2] or $aArray1[3] ... so add it to msgbox and youl have #include <String.au3> #include <Array.au3> $aArray1 = _StringBetween(StringReplace(BinaryToString(InetRead('http://sourceforge.net/search/?q='&'FireFox')),' ',''), 'timeline">', '</b>thisweek') ;~ _ArrayDisplay($aArray1, 'Default Search') MsgBox(0,'',$aArray1[0]) or if you need to cutt down to separated commands so that you can understand it better #include <String.au3> #include <Array.au3> $inet = InetRead('http://sourceforge.net/search/?q='&'FireFox') $string = BinaryToString($inet) $space_replace = StringReplace($string,' ','') $string_Between_Data = _StringBetween($space_replace, 'timeline">', '</b>thisweek') ;~ _ArrayDisplay($$string_Between_Data, 'Default Search') MsgBox(0,'',$string_Between_Data[0]) Edited November 27, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
MaoMao Posted November 27, 2011 Author Share Posted November 27, 2011 (edited) Okay! UR using the String to get the download data. Excillent! Here is the code which try to collect different software names in the search engine. Do you know why Line 34 is not working: space_replace = StringReplace($string,' ','') This program search all the names in the Separate Text file LogNames.txt The result is store in a Excel file. Please help. Why it is not working!!!!!! expandcollapse popup#include #include #include #include #include $ROW = 1 $COL = 1 $file = FileOpen(@WorkingDir&"LogNames.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf Local $oExcel = _ExcelBookNew() ;Create new book, make it visible ; Read in lines of text until the EOF is reached While 1 $LogLine = FileReadLine($file) If @error = -1 Then ExitLoop $ROW += 1 $LogCode = StringMid ($LogLine, 1, 20); Extract LogCode ; Original line $inet = InetRead('http://sourceforge.net/search/?q='&'FireFox') ; $inet = InetRead('http://sourceforge.net/search/?q='& $LogCode) $string = BinaryToString($inet) $space_replace = StringReplace($string,' ','') $string_Between_Data = _StringBetween($space_replace, 'timeline">', 'thisweek') ; _ArrayDisplay($$string_Between_Data, 'Default Search') MsgBox(0,'',$string_Between_Data[0]) ; Display the innerText on an element on the page with a name of "download" ;wRITE TO EXCEL FILE ;Declare the Array Local $aArray[$ROW][2] = [[$LogCode, $string_Between_Data]] _ExcelWriteSheetFromArray($oExcel, $aArray, $ROW, 1, 0, 0) ;0-Base Array parameters Wend; end of While SoundPlay("C:Windowsmediachimes.wav",1) MsgBox(4096,"Done!","All Log data files have been created!") MsgBox(0, "Exiting", "Press OK to Save File and Exit") _ExcelBookSaveAs($oExcel, @TempDir & "EXCELTemp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary _ExcelBookClose($oExcel) ; And finally we close out ; Separate Text file LogNames.txt ; LogNames.txt ; Firefox ; Chrome ; Internet Explorer ; Safari ; Opera Edited January 21, 2012 by MaoMao Link to comment Share on other sites More sharing options...
bogQ Posted November 27, 2011 Share Posted November 27, 2011 (edited) you did not copy $ infront variable name so changespace_replace = StringReplace($string,' ','')to$space_replace = StringReplace($string,' ','') Edited November 27, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
MaoMao Posted November 27, 2011 Author Share Posted November 27, 2011 Ah!!!! Thanks! IT Works Now! Excillent! Link to comment Share on other sites More sharing options...
MaoMao Posted December 4, 2011 Author Share Posted December 4, 2011 Further QuestionHow to do multiple entry to perform a list of search objects (Firefox, Chrome, Opera,,,,) in different sites i.e. www.google.com or www.yahoo.comPlease help for Autoit Google Advance SearchTrying to perform Advance search in Google Advance search:http://www.google.com/advanced_searchHow to get multiple result in th site to a file. Details Post Link" 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