• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3877
  • Last Modified:

AutoIT error Line -1

Hi all,

I work at a IT ServiceDesk.
In the last few weeks we get a lot of errors regarding AutoIT.
The complete error message is:
<AutoIt Error>
Line -1:
Error: Subscript used with non-Array variable.

Please take a look at the attchment for the screenshot that the user sent me.

Untill now, only a restage of the computer solved the problem.
Does anybody know how to deal with this issue?

I don't know if I've put it in the correct category.
If not, please accept my appologies.

Thank you for your support.
1 Solution
There is an error in the script that is running. You need to find out which script is running and then if possible post it here so we can help.

Dear alohadin,

It's because one variable is empty or not correctly set in the software made with AutoIt.

Do you have the source made with AutoIt or only the software ?

Best Regards
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

alohadinSEAuthor Commented:
Hello guys...
I'm sorry for the late answer...
but it was Christmas... I wasn't at work

I don't have the source code for it.
I'm only the serviceDesk... I can take over the users screen, but I don't think I can change the source code

this is a new error that we get more often
i was thinking that there is another way to avoid the error rather than changing the source
Without the code it is near impossible for us to help you. All I can say is maybe get hold of the person responsible for the AutoIT app and ask them to take a look at it and maybe fix the code so it doesnt happen again.


alohadinSEAuthor Commented:
I am unable to get the code...
I dispatched the case to the programmers... they will investigate further.

I would like to thank you for the support
I would also like to split these points between you all... donùt know if that's possible though
The error message is actually quite descriptive:  Subscript used with Non-Array Variable.  In other words, a variable that is not an array (containing a single value) is, at some point in the program, treated as an array (containing multiple values, referred by index).

Unfortunately, errors like these are common when you use AutoIT and you don't keep track of your variables.  This is because of the way AutoIT is designed, variables seldom need to be initialized and array variables are treated almost exactly the same way as single value variables.

The first thing to do to fix this would be to search for all instances of indices in the code, variables with subscripts and corresponding index (such as $var1[0]).  Then backtrack a bit to see if $var1 really is an array.  

var1 =  _Stringbetween($str1, ....)     ==> var1 is an array
var1 = StringinStr($str1, ....)   ==> var1 is NOT an array
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now