llolslim Posted August 13, 2009 Share Posted August 13, 2009 (edited) Hi all I'm trying to write a script that takes an excel spreadsheet, full of urls and download one at a time using inetget, naming them consecutively. It works perfectly, but I have to manually set how many cells there are in the list which I would like the enduser to be able to do. If I put an inputbox asking the question to fill the variable then I get the error (26) : ==> Subscript used with non-Array variable.: InetGet($address[$n], "./" & $filename & ".htm") InetGet($address^ ERROR I know this can happen if I call the array beyond how many entries there are, but as far as I can tell, the variables are unlinked. By commenting out line 18, it all works again, if I manually set the $cells variable any help greatly appreciated #include <Excel.au3> #include <Array.au3> Dim $filename Dim $address Dim $n Dim $count Dim $cells ;============================== ;data ;============================== $filename = 1 ;first filename $cells = 5 ; number of entries $count = 0 $n = 0 $cells = InputBox("Question", "How many cells?") $sFilePath1 = @ScriptDir & "\Book1.xls" $oExcel = _ExcelBookOpen($sFilePath1, 0) MsgBox(64, "", "Number of files to download: " & $cells) $address = _ExcelReadArray($oExcel, 1, 1, $cells, 1) Do InetGet($address[$n], "./" & $filename & ".htm") $filename = $filename + 1 SplashTextOn("Working...", $filename, 80, 50) $n = $n + 1 $count = $count + 1 Until $count = $cells SplashOff ( ) _ExcelBookClose($oExcel, 0, 0) MsgBox(0, "Complete", "Download Complete") Edited August 13, 2009 by llolslim Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 13, 2009 Share Posted August 13, 2009 See if this helps... InputBox returns a non-integer. It's a string. I ran into this recently... #include <Excel.au3> #include <Array.au3> Dim $filename Dim $address Dim $n Dim $count Dim $cells ;============================== ;data ;============================== $filename = 1 ;first filename $cells = 5 ; number of entries $count = 0 $n = 0 $cells = InputBox("Question", "How many cells?") $sFilePath1 = @ScriptDir & "\Book1.xls" $oExcel = _ExcelBookOpen($sFilePath1, 0) MsgBox(64, "", "Number of files to download: " & $cells) $address = _ExcelReadArray($oExcel, 1, 1, Int($cells), 1) Do InetGet($address[$n], "./" & $filename & ".htm") $filename = $filename + 1 SplashTextOn("Working...", $filename, 80, 50) $n = $n + 1 $count = $count + 1 Until $count = Int($cells) SplashOff ( ) _ExcelBookClose($oExcel, 0, 0) MsgBox(0, "Complete", "Download Complete") Let me know if that solves your issue, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
llolslim Posted August 13, 2009 Author Share Posted August 13, 2009 See if this helps... InputBox returns a non-integer. It's a string. I ran into this recently...Let me know if that solves your issue,Jarvisthat's perfect, thank you.Works a treat now >_<This little piece of code saves me around 4 - 5 hours of work a week Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 13, 2009 Share Posted August 13, 2009 that's perfect, thank you.Works a treat now >_<This little piece of code saves me around 4 - 5 hours of work a week Glad I could help, and elated that it saves you so much time/wk. Now you should get a half day on Fridays paid that is!! Enjoy,Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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