Sign in to follow this  
Followers 0
computergroove

Array varaible question

4 posts in this topic

#1 ·  Posted (edited)

I am making a form filler script. I want to send the second dimension in the $IPAddress arrays (the email addresses) Here is what I have: 

Global $Number = 5
Global $IPAddress1[2] = ["192.168.1.128","1@gmail.com"]
Global $IPAddress2[2] = ["192.168.1.101","2@gmail.com"]
Global $IPAddress3[2] = ["192.168.1.134","3@gmail.com"]
Global $IPAddress4[2] = ["192.168.1.123","4@gmail.com"]
Global $IPAddress5[2] = ["192.168.1.124","5@gmail.com"]
Global $IPArray[$Number] = [$IPAddress1[1], $IPAddress2[1], $IPAddress3[1], $IPAddress4[1], $IPAddress5[1]]

For $j = 0 To $Number - 1;Click Email Text Box
    $Temp = "$IPAddress"
    $Temp2 = $j + 1
    $Temp3 = $Temp & $Temp2 & "[1]"
    $Email = $Temp3
    MsgBox(0,"",$Email)

I am trying to Display each email individually as a debugging test. I must be breaking some kind of logic rules. Help

EDIT - The following is getting me by but it isnt what I want.

For $j = 1 To $Number;Click Email Text Box
    If $j = 1 Then
        $Temp = $IPAddress1[1]
    EndIf
    If $j = 2 Then
        $Temp = $IPAddress2[1]
    EndIf
    If $j = 3 Then
        $Temp = $IPAddress3[1]
    EndIf
    If $j = 4 Then
        $Temp = $IPAddress4[1]
    EndIf
    If $j = 5 Then
        $Temp = $IPAddress5[1]
    EndIf
    MsgBox(0,"",$Temp)
Next
Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



I must admit, I'm so confused on what you're actually trying to do.

Looks like you're making it way too hard.

Why not just a 2D array:

Global $IPAddress[5][2] = [["192.168.1.128","1@gmail.com"], _
    ["192.168.1.101","2@gmail.com"], ["192.168.1.134","3@gmail.com"], _
    ["192.168.1.123","4@gmail.com"], ["192.168.1.124","5@gmail.com"]]

Global $Temp, $Email
For $i = 0 To UBound($IPAddress) - 1
    $Temp = "$IPAddress[" & $i & "] = "
    $Email = $IPAddress[$i][1]
    MsgBox(0, "", $Temp & $Email)
Next

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Im adding to my existing code. I will rewrite a lot of it to work with the above format. I take it the _'s are required when you are adding multiple lines of array data?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Yes, "_" is a statement continuation character...

edit: This might help visualize it somewhat...

Global $IPAddress[5][2] =   [ _
    ["192.168.1.128","1@gmail.com"], _
    ["192.168.1.101","2@gmail.com"], _
    ["192.168.1.134","3@gmail.com"], _
    ["192.168.1.123","4@gmail.com"], _
    ["192.168.1.124","5@gmail.com"] _
                            ]

For $i = 0 To UBound($IPAddress) - 1
    MsgBox(0, "", $IPAddress[$i][0] &  '  ' & $IPAddress[$i][1])
Next
Edited by 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

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