Jump to content

Recommended Posts

Posted

hi there I got a script where I wanna use a variable to change what to read from.

The problem is in the in this example messagebox. How can I make it read the $sp1, and then in the next cycle $sp2 and so on until number 5.

in my example here it return in the messagebox $sp1. but I want it to read what actually is in the $sp1.

Thanks for any help I can get.

$sporingspakkenummer = 1
$sp1 = "123456789dhf1"
$sp2 = "123456789dhf2"
$sp3 = "123456789dhf3"
$sp4 = "123456789dhf4"
$sp5 = "123456789dhf5"
Do
    MsgBox("test1", "test", "$sp" & $sporingspakkenummer, "")
    $sporingspakkenummer = $sporingspakkenummer + 1
    Until $sporingspakkenummer = 5
Posted

You probably want to brush up on arrays, subscripted variables, indexes, etc.

There's good reading in the helpfile.

You could also go the learn-by-doing method and play around with this:

Global $sp[6]
$sp[1] = "123456789dhf1"
$sp[2] = "123456789dhf2"
$sp[3] = "123456789dhf3"
$sp[4] = "123456789dhf4"
$sp[5] = "123456789dhf5"
For $x = 1 to 5
    MsgBox("test1", "test", "$sp[" & $x & "] = " & $sp[$x])
Next
Posted

You probably want to brush up on arrays, subscripted variables, indexes, etc.

There's good reading in the helpfile.

You could also go the learn-by-doing method and play around with this:

Global $sp[6]
$sp[1] = "123456789dhf1"
$sp[2] = "123456789dhf2"
$sp[3] = "123456789dhf3"
$sp[4] = "123456789dhf4"
$sp[5] = "123456789dhf5"
For $x = 1 to 5
    MsgBox("test1", "test", "$sp[" & $x & "] = " & $sp[$x])
Next

Thank you very much! I'm new to Autoit and couldn't figure out how the arrays worked.

But thanks to your example I now got my script to work :idea:

Posted

There are lots of useful array functions to play with too in the array.au3 include file. See examples in the help file, just type _array to the help file index to see several of the functions.

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
  • Recently Browsing   0 members

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