Jump to content

array troubles


Recommended Posts

Long story short this sis the error I have going on but I'm struggling to figure out where it comes from. (I tried a few different things to make it work such as & _ to break it down thinking it was too long of a line.. which created a new error saying it was a naming issue.) All in all I'm a bit lost poking through this code trying to figure it out. Each ref $1v7 and such is just a link to different names and a number. Any theories on what to try would be greatly appreciated.

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
GLOBAL $2IL = [$1V7, $1V8, $1V9, $1VA, $1VB, $1VC, $1VD, $1VE, $1VF, $1VG, $1VH, $1VI, $1VJ, $1VK, $1VL, $1VM, $1VN, $1VO, $1VP, $1VQ, $1VR, $1VS, $1VT, $1VU, $1VV, $1VW, $1VX, $1VY, $1VZ, $1W0, $1W1, $1W2, $1W3, $1W4, $1W5, $1W6, $1W7, $1W8, $1W9, $1WA, $1WB, $1WC, $1WD, $1WE, $1WF, $1WG, $1WH, $1WI, $1WJ, $1WK, $1WL, $1WM, $1WN, $1WO, $1WP, $1WQ, $1WR, $1WS, $1WT, $1WU, $1WV, $1WW, $1WX, $1WY, $1WZ, $1X0, $1X1, $1X2, $1X3, $1X4, $1X5, $1X6, $1X7, $1X8, $1X9, $1XA, $1XB, $1XC, $1XD, $1XE, $1XF, $1XG, $1XH, $1XI, $1XJ, $1XK, $1XL, $1XM, $1XN, $1XO, $1XP, $1XQ, $1XR, $1XS, $1XT, $1XU, $1XV, $1XW, $1XX, $1XY, $1XZ, $1Y0, $1Y1, $1Y2, $1Y3, $1Y4, $1Y5, $1Y6, $1Y7, $1Y8, $1Y9, $1YA, $1YB, $1YC, $1YD, $1YE, $1YF, $1YG, $1YH, $1YI, $1YJ, $1YK, $1YL, $1YM, $1YN, $1YO, $1YP, $1YQ, $1YR, $1YS, $1YT, $1YU, $1YV, $1YW, $1YX, $1YY, $1YZ, $1Z0, $1Z1, $1Z2, $1Z3, $1Z4, $1Z5, $1Z6, $1Z7, $1Z8, $1Z9, $1ZA, $1ZB, $1ZC, $1ZD, $1ZE, $1ZF, $1ZG, $1ZH, $1ZI, $1ZJ, $1ZK, $1ZL, $1ZM, $1ZN, $1ZO, $1ZP, $1ZQ, $1ZR, $1ZS, $1ZT, $1ZU, $1ZV, $1ZW, $1ZX, $1ZY, $1ZZ, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $20A, $20B, $20C, $20D, $20E, $20F, $20G, $20H, $20I, $20J, $20K, $20L, $20M, $20N, $20O, $20P, $20Q, $20R, $20S, $20T, $20U, $20V, $20W, $20X, $20Y, $20Z, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $21A, $21B, $21C, $21D, $21E, $21F, $21G, $21H, $21I, $21J, $21K, $21L, $21M, $21N, $21O, $21P, $21Q, $21R, $21S, $21T, $21U, $21V, $21W, $21X, $21Y, $21Z, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $22A, $22B, $22C, $22D, $22E, $22F, $22G, $22H, $22I, $22J, $22K, $22L, $22M, $22N, $22O, $22P, $22Q, $22R, $22S, $22T, $22U, $22V, $22W, $22X, $22Y, $22Z, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $23A, $23B, $23C, $23D, $23E, $23F, $23G, $23H, $23I, $23J, $23K, $23L, $23M, $23N, $23O, $23P, $23Q, $23R, $23S, $23T, $23U, $23V, $23W, $23X, $23Y, $23Z, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $24A, $24B, $24C, $24D, $24E, $24F, $24G, $24H, $24I, $24J, $24K, $24L, $24M, $24N, $24O, $24P, $24Q, $24R, $24S, $24T, $24U, $24V, $24W, $24X, $24Y, $24Z, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $25A, $25B, $25C, $25D, $25E, $25F, $25G, $25H, $25I, $25J, $25K, $25L, $25M, $25N, $25O, $25P, $25Q, $25R, $25S, $25T, $25U, $25V, $25W, $25X, $25Y, $25Z, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $26A, $26B, $26C, $26D, $26E, $26F, $26G, $26H, $26I, $26J, $26K, $26L, $26M, $26N, $26O, $26P, $26Q, $26R, $26S, $26T, $26U, $26V, $26W, $26X, $26Y, $26Z, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $27A, $27B, $27C, $27D, $27E, $27F, $27G, $27H, $27I, $27J, $27K, $27L, $27M, $27N, $27O, $27P, $27Q, $27R, $27S, $27T, $27U, $27V, $27W, $27X, $27Y, $27Z, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $28A, $28B, $28C, $28D, $28E, $28F, $28G, $28H, $28I, $28J, $28K, $28L, $28M, $28N, $28O, $28P, $28Q, $28R, $28S, $28T, $28U, $28V, $28W, $28X, $28Y, $28Z, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $29A, $29B, $29C, $29D, $29E, $29F, $29G, $29H, $29I, $29J, $29K, $29L, $29M, $29N, $29O, $29P, $29Q, $29R, $29S, $29T, $29U, $29V, $29W, $29X, $29Y, $29Z, $2A0, $2A1, $2A2, $2A3, $2A4, $2A5, $2A6, $2A7, $2A8, $2A9, $2AA, $2AB, $2AC, $2AD, $2AE, $2AF, $2AG, $2AH, $2AI, $2AJ, $2AK, $2AL, $2AM, $2AN, $2AO, $2AP, $2AQ, $2AR, $2AS, $2AT, $2AU, $2AV, $2AW, $2AX, $2AY, $2AZ, $2B0, $2B1, $2B2, $2B3, $2B4, $2B5, $2B6, $2B7, $2B8, $2B9, $2BA, $2BB, $2BC, $2BD, $2BE, $2BF, $2BG, $2BH, $2BI, $2BJ, $2BK, $2BL, $2BM, $2BN, $2BO, $2BP, $2BQ, $2BR, $2BS, $2BT, $2BU, $2BV, $2BW, $2BX, $2BY, $2BZ, $2C0, $2C1, $2C2, $2C3, $2C4, $2C5, $2C6, $2C7, $2C8, $2C9, $2CA, $2CB, $2CC, $2CD, $2CE, $2CF, $2CG, $2CH, $2CI, $2CJ, $2CK, $2CL, $2CM, $2CN, $2CO, $2CP, $2CQ, $2CR, $2CS, $2CT, $2CU, $2CV, $2CW, $2CX, $2CY, $2CZ, $2D0, $2D1, $2D2, $2D3, $2D4, $2D5, $2D6, $2D7, $2D8, $2D9, $2DA, $2DB, $2DC, $2DD, $2DE, $2DF, $2DG, $2DH, $2DI, $2DJ, $2DK, $2DL, $2DM, $2DN, $2DO, $2DP, $2DQ, $2DR, $2DS, $2DT, $2DU, $2DV, $2DW, $2DX, $2DY, $2DZ, $2E0, $2E1, $2E2,
GLOBAL $2IL = [$1V7, ^ ERROR

 

Link to comment
Share on other sites

How does the line end? Any more code you can post for us to reproduce?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

53 minutes ago, CodeCrusher said:

(I tried a few different things to make it work such as & _ to break it down thinking it was too long of a line.. which created a new error saying it was a naming issue.)

To break line of a declaration, you have to use only _ , instead of & _ :

Global $arrArray[] = ["Element 1", _
                      "Element 2", _
                      "Element n"]

 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

In the post #1 example, your declaration appears not to have a closing square bracket at the end of the declaration, only a coma. This missing "]" will cause an error.
If you want $1V7 to $2IL put into an array, then the following example does that.

#include <Array.au3>

Global $2IL[_Base36ToDec("2IL") - _Base36ToDec("1V7") + 1]

For $i = 0 To UBound($2IL) - 1
    $2IL[$i] = "$" & _Dec2Base36(_Base36ToDec("1V7") + $i)
    ;ConsoleWrite($i & "   " & _Dec2Base36(_Base36ToDec("1V7") + $i) & @CRLF)
Next
_ArrayDisplay($2IL)


Func _Dec2Base36($iDec)
    Local $aBase36 = StringSplit("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 2)
    Local $sRet = ""
    For $i = 0 To Int(Log($iDec) / Log(36))
        $sRet = $aBase36[Mod($iDec / 36 ^ $i, 36)] & $sRet
    Next
    Return $sRet
EndFunc   ;==>_Dec2Base36

Func _Base36ToDec($str)
    Local $iRet, $a = StringSplit($str, "", 2), $UB = UBound($a) - 1
    For $i = 0 To $UB
        $iRet += 36 ^ ($UB - $i) * (StringInStr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", $a[$i]) - 1)
    Next
    Return $iRet
EndFunc   ;==>_Base36ToDec

Edit:

Replaced:-
$aTemp = StringRegExp("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", "(?i)(.*)" & $a[$i], 3)
$Index = StringLen($aTemp[0])
$iRet += 36 ^ ($UB - $i) * $Index
with:-
$iRet += 36 ^ ($UB - $i) * (StringInStr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", $a[$i]) - 1)

 

Similar example, but with variable base functions.

#include <Array.au3>
; https://www.autoitscript.com/forum/topic/194949-array-troubles/?do=findComment&comment=1398101

Local $iBase = 36 ; 62 ;
Local $2IL[_BaseX2Dec("2IL", $iBase) - _BaseX2Dec("1V7", $iBase) + 1]

For $i = 0 To UBound($2IL) - 1
    $2IL[$i] = "$" & _Dec2BaseX(_BaseX2Dec("1V7", $iBase) + $i, $iBase)
    ;ConsoleWrite($i & "   " & _Dec2BaseX(_BaseX2Dec("1V7", $iBase) + $i, $iBase) & @CRLF)
Next
_ArrayDisplay($2IL)


; Base 62 is maximum
Func _Dec2BaseX($iDec, $iBase)
    Local $sBaseX = StringLeft("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", $iBase)
    Local $aBaseX = StringSplit($sBaseX, "", 2)
    Local $sRet = ""
    For $i = 0 To (Log($iDec) / Log($iBase))
        $sRet = $aBaseX[Mod($iDec / $iBase ^ $i, $iBase)] & $sRet
    Next
    Return $sRet
EndFunc   ;==>_Dec2BaseX

; Base 62 is maximum
Func _BaseX2Dec($str, $iBase)
    Local $sBaseX = StringLeft("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", $iBase)
    Local $iRet, $a = StringSplit($str, "", 2), $UB = UBound($a) - 1
    For $i = 0 To $UB
        $iRet += $iBase ^ ($UB - $i) * (StringInStr($sBaseX, $a[$i], 1) - 1)
    Next
    Return $iRet
EndFunc   ;==>_BaseX2Dec

A base13 example.

MsgBox(0, "", 'The ultimate question of life the universe and everything is "What is 6 times 9?".' & @CRLF & _
        'The ultimate answer of life the universe and everything is "' & _Dec2BaseX(6 * 9, 13) & '" (Base 13).')

; Base 62 is maximum
Func _Dec2BaseX($iDec, $iBase)
    Local $sBaseX = StringLeft("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", $iBase)
    Local $aBaseX = StringSplit($sBaseX, "", 2)
    Local $sRet = ""
    For $i = 0 To (Log($iDec) / Log($iBase))
        $sRet = $aBaseX[Mod($iDec / $iBase ^ $i, $iBase)] & $sRet
    Next
    Return $sRet
EndFunc   ;==>_Dec2BaseX

 

Edited by Malkey
Streamline a function
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...