AutoIT error Line -1

Posted on 2009-12-23
Last Modified: 2013-11-10
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.
Question by:alohadin
    LVL 9

    Expert Comment

    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.

    LVL 34

    Expert Comment

    LVL 10

    Expert Comment

    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
    LVL 1

    Author Comment

    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
    LVL 9

    Expert Comment

    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.


    LVL 1

    Accepted Solution

    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
    LVL 1

    Expert Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    thread-safe code in c++ 2 58
    Problem to setup 18 65
    java continue statement 10 50
    drawing animated level bar based on numbers 3 39
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now