Damastah Posted June 26, 2008 Share Posted June 26, 2008 In my script i have a line which goes a little something like this. $opt = $CmdLine[1] msgbox(0, "", $opt) I get the error: "Array variable has incorrect number of subscripts or subscript dimention range exceeded." this is only like my third line of code and I put in the command line when i ran it, C:\scripts\whatever.au3 1It tells me that the error is the $cmdLine [1] part. this is what it looks like: ... $opt = $CmdLine [1] $opt = ^ ERROR Error: Array variable has incorrect number of subscripts or subscript dimention range exceeded.What's wrong? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2008 Developers Share Posted June 26, 2008 (edited) Add a test to ensure that the $cmdline array contains it. If $cmdline[0] > 0 then Jos Edited June 26, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
weaponx Posted June 26, 2008 Share Posted June 26, 2008 If $CmdLine[0] > 0 Then For $X = 1 to $CmdLine[0] ConsoleWrite("["&$X&"]: " & $CmdLine[$X] & @CRLF) Next Else ConsoleWrite("No command line arguments passed" & @CRLF) EndIf Link to comment Share on other sites More sharing options...
Jeemo Posted July 7, 2008 Share Posted July 7, 2008 (edited) In my script i have a line which goes a little something like this. $opt = $CmdLine[1] msgbox(0, "", $opt) I get the error: "Array variable has incorrect number of subscripts or subscript dimention range exceeded." this is only like my third line of code and I put in the command line when i ran it, It tells me that the error is the $cmdLine [1] part. What's wrong?In addition to what Jos and weaponx wrote, you need to make sure that if you're calling your script as an .au3 file (as opposed to a compiled .exe) then you need to call it like this: "C:\Program Files\AutoIT\AutoIT3.exe" myscript.au3 1 For testing purposes, within SciTE you can hit Shift+F8 to show the Parameters box. Any values you put in any of these boxes will emulate passing parameters from a command line or shortcut. Edited July 7, 2008 by Jeemo An emoticon is worth a dozen words. 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