Jump to content

Recommended Posts

Posted

I have about 7000 lines of code, but every once in awhile I get these errors about "array variable has incorrect number of subscripts", but the line for the error is 32400 - not in my code at all, so how do I go about finding out how to resolve the error? Is there some type of testing that I am not doing that I should be doing?

 

My code, or at least the part of the code that is being ran when the error occurs 

Func _ClearEdge($bCookies, $bCache, $bBackup)
    Local $bDefault = True
    Local $dDateStamp = _NowDate()
    Local $atempdate = StringSplit($dDateStamp, '/')
    If Not IsArray($atempdate) Then Return
    
    Local $sDate = $atempdate[1] & $atempdate[2] & $atempdate[3]
    Local $sPathEdge = $sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\Default\Network"
    Local $sPathEdgeCache = $sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\Default\cache\Cache_Data"
    If $bCookies Or $bCache Or $bBackup Then
        While ProcessExists('msedge.exe')
            ProcessClose('msedge.exe')
            ConsoleWrite('edge exist' & @CRLF)
        WEnd


        If Not FileExists($sPathEdge & '\Cookies') Then
            If FileExists($sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\Local State") Then
                Local $hLocalStateFile = FileOpen($sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\Local State")

                Local $sLocalStateFile = FileRead($hLocalStateFile)
    
                FileClose($hLocalStateFile)
                Local $iFoundLocationLastActive = StringInStr($sLocalStateFile, "last_active_profiles")

                If $iFoundLocationLastActive Then
    
                    Local $sTempGetLastActive = StringMid($sLocalStateFile, $iFoundLocationLastActive + 22, 30)
                    Local $iTempGetLastActive = StringInStr($sTempGetLastActive, ']')
                    $sTempGetLastActive = StringMid($sLocalStateFile, $iFoundLocationLastActive + 22, $iTempGetLastActive)
                    If $sTempGetLastActive = 0 Then
                        $iFoundLocationLastActive = StringInStr($sLocalStateFile, "last_used")
    

                        $sTempGetLastActive = StringMid($sLocalStateFile, $iFoundLocationLastActive + 12, 15)
                        $iTempGetLastActive = StringInStr($sTempGetLastActive, '"')
                        $sTempGetLastActive = StringMid($sLocalStateFile, $iFoundLocationLastActive + 12, $iTempGetLastActive - 1)
    
                    Else
                        $sTempGetLastActive = StringMid($sTempGetLastActive, 3, StringInStr($sTempGetLastActive, '"', 0, 2) - 3)
    
                    EndIf
                EndIf

                If FileExists($sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\" & $sTempGetLastActive & '\network') Then
                    $bDefault = False
                    $sPathEdgeCache = $sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\" & $sTempGetLastActive & '\cache'
                Else
                    MsgBox($MB_TOPMOST, 'NO FILES FOUND', 'No Cookie file(s) were found to delete! Try opening your browser, as that means they have already been deleted or call IT if not.')
                    Return
                EndIf
            EndIf

        EndIf


        If Not $bDefault Then
            Local $sPathToCookies = $sUSER_PATH & "\AppData\Local\Microsoft\Edge\Chrome\User Data\" & $sTempGetLastActive & "\Network"

        Else
            Local $sPathToCookies = $sPathEdge
        EndIf

    
        If $bBackup Then

            If Not FileCopy($sUSER_PATH & "\AppData\Local\Microsoft\Edge\User Data\Default\Network\*.*", $sUSER_PATH & '\desktop\backup\edge\' & $sDate & '\*.*', $FC_CREATEPATH + $FC_OVERWRITE) Then
                MsgBox($MB_TOPMOST, @error, 'Error backing up files')
            EndIf
        EndIf
        


        If $bCookies Then

            If Not FileExists($sPathEdge & '\Cookies') Then Return MsgBox($MB_TOPMOST, 'NO FILES FOUND', 'No Cookie file(s) were found to delete! Try opening your browser, as that means the have already been deleted.')


            Local $iDelete = FileDelete($sPathEdge)
            If $iDelete Then
                MsgBox($MB_TOPMOST, 'Completed', 'Cookies have been deleted', 1)
            Else
                MsgBox($MB_TOPMOST, 'ERROR ' & @error, 'There was an error deleting cookies')
            EndIf
        EndIf


        If $bCache Then
            Local $iDeleteCache = FileDelete($sPathEdgeCache)
            If $iDeleteCache Then
                MsgBox($MB_TOPMOST, 'Completed', 'Edge Cache has been deleted', 2)
            Else
                MsgBox($MB_TOPMOST, 'ERROR ' & @error, 'There was an error deleting the Edge Cache')
            EndIf
        EndIf

    Else
        Return
    EndIf


EndFunc   ;==>_ClearEdge

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted (edited)

Hi @nitekram ✌️ ,

please try to add the following two lines to your script (entry point script, in case you have multiple files). Then compile your script.

#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/sf /sv /mo /rm /rsln

These directives create a <your-script-name>_stripped.au3 file which includes all #include <file...> files at the top of your actual script. In this way, you should be able to identify the correct line where the error occurs.

Let me know if this helps.

Best regards
Sven

Edited by SOLVE-SMART

==> AutoIt related: 🔗 Organization AutoIt Community🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet🔗 autoit-webdriver-boilerplate

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)

Checking my code, thanks

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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...