Doug Porter Posted June 12, 2007 Share Posted June 12, 2007 Hello all,I'm fairly new with using AutoIt, I've only written scripts for pranks and novelty. But now I seem to have a real need for it:My problemThere is this website that sells electronic components, I want to be able to extract a few pieces of information from the listings and load them into an Excel spreadsheet for analyzation.An examplehttp://www.newark.com/jsp/search/results.j...AN_PART_NUM%7c0I would need to extract the price, capacitance and voltage from each on that page.Then that info would need to be placed into Excel.Is this at all feasible, and if so, does anyone have any suggestions of how or where to start?Thanks,Doug Link to comment Share on other sites More sharing options...
BrettF Posted June 12, 2007 Share Posted June 12, 2007 Is this at all feasible, and if so, does anyone have any suggestions of how or where to start?Of course take a look in the helpfile at all of the _IE functions.A list of functions that would be useful:_IETableGetCollection _IETableWriteToArrayStringRegExpReplace/StringReplaceStringSpilt could be useful Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 12, 2007 Moderators Share Posted June 12, 2007 Quick and dirt, but it works! expandcollapse popup#include <IE.au3> #include <GUIConstants.au3> #Include <GuiListView.au3> Opt("GuiOnEventMode", True) $GUI = GUICreate("Newark", 620, 370) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $ListView1 = GUICtrlCreateListView("Newark Part #|Name & Part #|Description|RoHS|Avail.|" & _ "Price For|List Price|Capacitance|Tolerance|Voltage|Terminal Type|Series", 10, 10, 600, 350) GUISetState(@SW_SHOW) _SearchNewark() While 1 Sleep(10) WEnd Func _SearchNewark() _GUICtrlListViewDeleteAllItems($ListView1) Ping("www.newark.com") If @error Then MsgBox(0, "Connection Error!", "There was a problem connecting to the internet.") Return EndIf $oIE = _IECreate("http://www.newark.com/jsp/search/results.jsp?N=1000121&Ns=PLS_NIC_FLAG%7c0%7c%7cPLS_MAN_PART_NUM%7c0", 0, 0) $oTable = _IEGetObjByName($oIE, "searchResults") $aResults = _IETableWriteToArray($oTable) _IEQuit($oIE) For $i = 2 To UBound($aResults, 2) - 1 $sPN = $aResults[1][$i] $sNamePN = $aResults[2][$i] $sDesc = $aResults[3][$i] $sRoHS = $aResults[5][$i] $sAvail = $aResults[6][$i] $sPriceFor = $aResults[8][$i] $sListPrice = $aResults[9][$i] $sCapacitance = $aResults[11][$i] $sTolerance = $aResults[12][$i] $sVoltage = $aResults[13][$i] $sType = $aResults[14][$i] $sSeries = $aResults[15][$i] If $aResults[0][$i] == 0 Then ContinueLoop $lv_item = GUICtrlCreateListViewItem($sPN & "|" & $sNamePN & "|" & $sDesc & "|" & $sRoHS & "|" & _ $sAvail & "|" & $sPriceFor & "|" & $sListPrice & "|" & $sCapacitance & "|" & _ $sTolerance & "|" & $sVoltage & "|" & $sType & "|" & $sSeries, $ListView1) Next For $i = 0 To 6 _GUICtrlListViewSetColumnWidth($ListView1, $i, $LVSCW_AUTOSIZE) Next EndFunc ;==>_SearchNewark Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
Doug Porter Posted June 12, 2007 Author Share Posted June 12, 2007 Wow, Thanks to both of you. I will play around with this. 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