Sign in to follow this  
Followers 0
AramisResearch

Going Dim on Dim's?

9 posts in this topic

I'm having problems understanding what my problem is here - maybe I'm just being Dim. In any case, I made this declaration:

Dim $DNSOct[4][4] = [["172","16","96","22"],["172","17","148","21"],["172","16","96","23"],["172","17","148","22"]]

I THOUGHT I was defining a 4x4 array and filling it with those values. I get this error:

"No variable given for "Dim", "Local", "Global" or "Const" statement."

I found some hint that I should be using the beta version of AutoIT. I'm pretty sure that's what I am using.

Any ideas?

Thanks,

-Chris

Share this post


Link to post
Share on other sites



lol interesting thread title...

Anyway,

Try looking 'Dim' up in the helpfile, they show you how to properly define the valuse of an array, because I don't think your syntax is correct

Hey... Online Helpfile !!Sweet!!

http://www.autoitscript.com/autoit3/docs/

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I found some hint that I should be using the beta version of AutoIT. I'm pretty sure that's what I am using.

your syntax is correct, however you need the beta version. Please make sure you really used the beta interpreter. Check with this at the beginning of your script:

msgbox(4096,"Version",@AutoItVersion)

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

For this particular instance, they have to be 5x5.

Dim $DNSOct[5][5]

Then, from there, you'd have to make it equal your data

Edited by Minion

Share this post


Link to post
Share on other sites

your syntax is correct, however you need the beta version. Please make sure you really used the beta interpreter. Check with this at the beginning of your script:

msgbox(4096,"Version",@AutoItVersion)

Cheers

Kurt

OK, next dumb question: You were right. I loaded the beta, but it's using v3.1.1.0 (NOT the beta). I can go into HKEY_CLASSES_ROOT on my PC and manually mess with the path that it looks for AutoIT.exe on (add \beta in the middle) and now I get past that error, but was this supposed to have been automagically taken care of when I installed the beta version?

Now that I have gotten past that error I get to this chunk of code:

Func _GetDNSWins()

    Local $DNSLine
    Local $InputDNSOct
    Local $XCoord, $YCoord

    GUICreate("DNS & WINS Settings", 500, 500)
    
    $YCoord = 5

    For $Lines = 1 to 4

        $XCoord = 5

        $DNSLine = GUICtrlCreateLabel("DNS " & $Lines & ": ", $XCoord, $YCoord, 100, 18)
        $XCoord = $XCoord + 90
        For $X = 1 to 4 
            $InputDNSOct = GUICtrlCreateInput($DNSOct[$Lines][$X], $XCoord, $YCoord, 30, 18, $ES_NUMBER)
            GUICtrlSetLimit(-1, 3)
            $Dot = GUICtrlCreateLabel(".", $XCoord + 35, $YCoord, 10, 18)
            $XCoord = $XCoord + 40
        Next
        $YCoord = $YCoord + 30
    Next

    $SubmitButton = GUICtrlCreateButton("Submit", 215, 450, 70, 20)
    
    GUISetState()
        While 1
            $msg = GUIGetMsg()
            If $msg = $SubmitButton Then ExitLoop
        WEnd

EndFunc

As you can probably tell, I am looking for a more efficient way of laying out a GUI to plug numbers into. This will pre-populate a GUI form with pre-set addresses that the user has the option to change or just accept. What I get is this:

$InputDNSOct = GUICtrlCreateInput($DNSOct[$Lines][$X], $XCoord, $YCoord, 30, 18, $ES_NUMBER)

$InputDNSOct = GUICtrlCreateInput(^ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

This doesn't make sense to me. I understand the words, but at the first pass through the nested loop I should be reading $DNSOct[1][1]. then $DNSOct[1][2], then $DNSOct[1][3], etc, up to $DNSOct[4][4]. Did I miss something here?

Thanks,

-Chris

Share this post


Link to post
Share on other sites

Did I miss something here?

Array's start at 0, not 1. The first element is 0 and the last element is 3 in your array.

Share this post


Link to post
Share on other sites

Array's start at 0, not 1. The first element is 0 and the last element is 3 in your array.

Doh! OK. Thank you.

Share this post


Link to post
Share on other sites

OK, next dumb question: You were right. I loaded the beta, but it's using v3.1.1.0 (NOT the beta). I can go into HKEY_CLASSES_ROOT on my PC and manually mess with the path that it looks for AutoIT.exe on (add \beta in the middle) and now I get past that error, but was this supposed to have been automagically taken care of when I installed the beta version?

No need to this manually. Running the below script will toggle stable/beta :

%programfiles%\AutoIt3\beta\Extras\Toggle AU3 Beta.au3

Share this post


Link to post
Share on other sites

OK, next dumb question: You were right. I loaded the beta, but it's using v3.1.1.0 (NOT the beta). I can go into HKEY_CLASSES_ROOT on my PC and manually mess with the path that it looks for AutoIT.exe on (add \beta in the middle) and now I get past that error, but was this supposed to have been automagically taken care of when I installed the beta version?

Much easier way to do things: Run your scripts from inside the SciTE editor with F5 for Prod (stable), and Alt-F5 for Beta. When you are ready to run it outside the editor, compile it with F7 for Prod and Alt-F7 for Beta.

If you're not using SciTE with AutoIT, you are working way too hard!

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0