I'm trying to pull prices on whey from a couple sites so I can easily check who's cheapest when I need to order more.
I get an error on line 33 (the first time i try to call one of my functions). Can you even do what I'm trying to do? call in a call in a call.
AutoIt
;includes #include <ie.au3> #include <excel.au3> #include <array.au3> #include <file.au3> #include <string.au3> #include <inet.au3> #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ;globals nigga Global $sectionarry[12] = ["amazon product name", "amazon price", "amazon url", "gnc productname", "gnc price", "gnc url", "bodybuilding product name", "bodybuilding price", "bodybuilding url", "vitaminshoppe product name", "vitaminshoppe price", "vitaminshoppe url"] Global $col = 3 ;excel file, create if doesnt exist (format premade) then read and put urls into array If FileExists("wheyurls.XLS") = 0 Then $oExcel = _ExcelBookNew() _ExcelBookSaveAs($oExcel, @ScriptDir & "\wheyurls.xls", "xls", 0, 0) For $i = 0 to UBound( $sectionarry, 1) - 1 ;create excel file w/ columns at top _ExcelWriteCell($oExcel,$sectionarry[$i],1,$i + 1) _ExcelBookSave($oExcel) Next EndIf If FileExists("wheyurls.XLS") = 1 Then $oExcel=_ExcelBookOpen(@ScriptDir & "\wheyurls.xls") EndIf Do If $col=3 Then Call("pricetocell",Call("_amazonprice",Call("urlfromarray",$col),$col) Call("nametocell",Call("_amazonname",Call("urlfromarray",$col),$col) ElseIf $col=6 Then Call("pricetocell",Call("_gncprice",Call("urlfromarray",$col),$col) Call("nametocell",Call("_gncname",Call("urlfromarray",$col),$col) ElseIf $col=9 Then Call("pricetocell",Call("_bodybuildingprice",Call("urlfromarray",$col),$col) Call("nametocell",Call("_bodybuildingname",Call("urlfromarray",$col),$col) Else Call("pricetocell",Call("_vitaminshoppeprice",Call("urlfromarray",$col),$col) Call("nametocell",Call("_vitaminshoppename",Call("urlfromarray",$col),$col) EndIf $col+=3 Until $col=12 _ExcelBookSave($oExcel) Func getnumberurl($col) ;gets the number of urls in column Local $int_url = 0 For $i = 2 To $oExcel.ActiveSheet.UsedRange.Rows.Count $s_check = _ExcelReadCell($oExcel,$i,$col) If IsString($s_check) = 1 Then $int_url+=1 ;int url is the # of urls in the column Else EndIf Next Return $int_url ;number of urls in the column EndFunc Func readurl($col) ;takes in column $arrayurl = _ExcelReadArray($oExcel,2,$col,Call("getnumberurl",$col),1) Return $arrayurl ;0 based array of urls EndFunc Func urlfromarray($col) ;input column, create array of all urls then returns url string $arrayurl = Call("readurl",$col) For $k = 0 To UBound($arrayurl,1) - 1 $url = $arrayurl[$k] Next Return $url EndFunc ;output url string Func pricetocell($s_price,$col) For $p = 2 to UBound(Call("readurl",$col), 1) _ExcelWriteCell($oExcel,$s_price,$p,$col - 1) Next EndFunc Func nametocell($s_name,$col) For $p = 2 to UBound(Call("readurl",$col), 1) _ExcelWriteCell($oExcel,$s_name,$p,$col - 2) Next EndFunc ; ; ; Func _amazonprice($s_url) ;input url string $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<b class="priceLarge">',"</b>") Return $aArray[0] EndFunc ;output price string Func _amazonname($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<span id="btAsinTitle">',"</span>") Return $aArray[0] EndFunc ; ; ; Func _gncprice($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<span class="priceNow">Price: ',"</span>") Return $aArray[0] EndFunc Func _gncname($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<span id="btAsinTitle">',"</span>") Return $aArray[0] EndFunc ; ; ; Func _bodybuildingprice($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<span class="price">',"</span>") Return $aArray[0] EndFunc Func _bodybuildingname($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'</span>',"</h1>") $aArray[0] = StringReplace($aArray[0], '"', "") ;gets rid of quotes $aArray[0] = StringReplace($aArray[0], " ", "") ;gets rid of spaces Return $aArray[0] EndFunc ; ; ; Func _vitaminshoppeprice($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<li class="saleValue-Price">Your Price: ',"</li>") Return $aArray[0] EndFunc Func _vitaminshoppename($s_url) $s_urlbody = _INetGetSource($s_url,"true") $aArray = _StringBetween($s_urlbody,'<h1 class="prdTitle">',"</h1>") Return $aArray[0] EndFunc