Jump to content

Recommended Posts

Posted

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 1

It 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?
Posted

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

  • 2 weeks later...
Posted (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 by Jeemo

An emoticon is worth a dozen words.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...