Jump to content

Subscript used on non-accessible variable


Heoagua
 Share

Recommended Posts

Dear,

I coded a auto utility with autoit-v3 and now I'm using autoit-v3.3.14.1 to prepare and upgrade but get following error:

Subscript used on non-accessible variable.:
For $i=1 to $aArray[0][0]-1
For $i=1 to $aArray^ ERROR

Please help me

Thanks!

Link to comment
Share on other sites

  • Moderators

Heoagua,

Welcome to the AutoIt forum.

The error is obviously at line 238745....

 

 

 

....which is as sensible answer as you will get unless you let us see the code you are using - although we can say immediately that it would seem you have an array dimension mismatch. When you do post your code please use Code tags - see here how to do it.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

The error message also reports the line number. Just click on the error message to take you to it as well.

Thank for ur soon reply

Here is my code:

Func _cmdActionFIMI()
Local $tmpNotice,$Result[6],$tmpRecNo=1,$Addr="
https://.....com.vn",$Open
Local $Update,$CardNo,$aArray,$ListNo=0,$FListFinish=0,$oIE,$tmpCondition,$GetID=False
    ;$oIE=_LoginFIMI($FUserName,_Decode($FPassword),$Addr)
    $oIE=1
    If $oIE=0 Then
        Return 0
    EndIf
    ToolTip("OPENNING "&$FXLSPath)
    $oExcel = _Excel_Open($FXLSPath,1)
    If $oExcel=0 Then
        Switch @error
            Case 1
                MsgBox(0, "Óe !!!", "Cannot open !")
            Case 2
                MsgBox(0, "Óe !!!", "Not find file !")
        EndSwitch
        ToolTip("")
        Return 0
    EndIf
    _Excel_BookOpen($oExcel, "nhaplieu")
    ;$Open=Not (_ExcelReadCell($oExcel,13,5)="Đóng thẻ")
    ;If $Open Then
    ;    MsgBox(0,"o",$Open)
    ;EndIf
    ;Exit
    _Excel_BookOpen($oExcel, "ketqua")

    $aArray=_Excel_RangeRead($oExcel)
    For $i=1 to $aArray[0][0]-1
        If $aArray[$i+1][2]<>"" Then $ListNo+=1
    Next
    For $i=1 to $ListNo
        If $aArray[$i+1][4]<>"" Then $FListFinish+=1
    Next
    Do
        $CardNo=$aArray[$tmpRecNo+1][2]
        $Update=$aArray[$tmpRecNo+1][4]
        If $Update="" Then
            If GUICtrlRead($chkID)=$GUI_CHECKED Then $GetID=True
            $Result=_Input1CardNo($FListFinish+1,$ListNo,$CardNo,$Addr,$oIE,$GetID,$Open)
            $FListFinish+=1
            $tmpCondition='DPType="'&StringMid($Result[2],5,3)&'" AND Acct="'&StringRight($Result[2],6)&'"'
            $tmpNotice=StringReplace(_GetValue("Notice","CIF",$tmpCondition),4,$Result[0])
            _SQLite_Exec(-1, 'UPDATE CIF SET Notice="'&$tmpNotice&'" WHERE '&$tmpCondition)
            _SQLite_Exec(-1, 'UPDATE CIF SET CardNo="'&$CardNo&'" WHERE '&$tmpCondition)
            _Excel_RangeWrite($oExcel,$Result[1],$tmpRecNo+1,3)
            _Excel_RangeWrite($oExcel,$Result[2],$tmpRecNo+1,4)
            _Excel_RangeWrite($oExcel,$Result[3],$tmpRecNo+1,5)
            _Excel_RangeWrite($oExcel,$Result[4],$tmpRecNo+1,6)
            _Excel_RangeWrite($oExcel,$Result[5],$tmpRecNo+1,7)
        EndIf
        $tmpRecNo+=1
    Until $tmpRecNo>$ListNo
    ToolTip("")
    MsgBox(0,"OK!","I've finished!!!")
EndFunc

Regards

Link to comment
Share on other sites

Heoagua,

Check the error code returned from this...

$aArray=_Excel_RangeRead($oExcel)

See the Help file for possible codes.

Please post code in code tags.  "<>" on the toolbar.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Func _cmdActionFIMI()
Local $tmpNotice,$Result[6],$tmpRecNo=1,$Addr="https://.....com.vn",$Open
Local $Update,$CardNo,$aArray,$ListNo=0,$FListFinish=0,$oIE,$tmpCondition,$GetID=False
    ;$oIE=_LoginFIMI($FUserName,_Decode($FPassword),$Addr)
    $oIE=1
    If $oIE=0 Then
        Return 0
    EndIf
    ToolTip("OPENNING "&$FXLSPath)
    $oExcel = _Excel_Open($FXLSPath,1)
    If $oExcel=0 Then
        Switch @error
            Case 1
                MsgBox(0, "Óe !!!", "Cannot open !")
            Case 2
                MsgBox(0, "Óe !!!", "Not find file !")
        EndSwitch
        ToolTip("")
        Return 0
    EndIf
    _Excel_BookOpen($oExcel, "nhaplieu")
    ;$Open=Not (_ExcelReadCell($oExcel,13,5)="Đóng thẻ")
    ;If $Open Then
    ;    MsgBox(0,"o",$Open)
    ;EndIf
    ;Exit
    _Excel_BookOpen($oExcel, "ketqua")

    $aArray=_Excel_RangeRead($oExcel)
    For $i=1 to $aArray[0][0]-1
        If $aArray[$i+1][2]<>"" Then $ListNo+=1
    Next
    For $i=1 to $ListNo
        If $aArray[$i+1][4]<>"" Then $FListFinish+=1
    Next
    Do
        $CardNo=$aArray[$tmpRecNo+1][2]
        $Update=$aArray[$tmpRecNo+1][4]
        If $Update="" Then
            If GUICtrlRead($chkID)=$GUI_CHECKED Then $GetID=True
            $Result=_Input1CardNo($FListFinish+1,$ListNo,$CardNo,$Addr,$oIE,$GetID,$Open)
            $FListFinish+=1
            $tmpCondition='DPType="'&StringMid($Result[2],5,3)&'" AND Acct="'&StringRight($Result[2],6)&'"'
            $tmpNotice=StringReplace(_GetValue("Notice","CIF",$tmpCondition),4,$Result[0])
            _SQLite_Exec(-1, 'UPDATE CIF SET Notice="'&$tmpNotice&'" WHERE '&$tmpCondition)
            _SQLite_Exec(-1, 'UPDATE CIF SET CardNo="'&$CardNo&'" WHERE '&$tmpCondition)
            _Excel_RangeWrite($oExcel,$Result[1],$tmpRecNo+1,3)
            _Excel_RangeWrite($oExcel,$Result[2],$tmpRecNo+1,4)
            _Excel_RangeWrite($oExcel,$Result[3],$tmpRecNo+1,5)
            _Excel_RangeWrite($oExcel,$Result[4],$tmpRecNo+1,6)
            _Excel_RangeWrite($oExcel,$Result[5],$tmpRecNo+1,7)
        EndIf
        $tmpRecNo+=1
    Until $tmpRecNo>$ListNo
    ToolTip("")
    MsgBox(0,"OK!","I've finished!!!")
EndFunc

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...