Jump to content

Variable in variable name


Recommended Posts

How can i do smth like this (hard for me to explain but i'll try; it is possible in C with %i% or smth like that)

For $i = 1 to 4

Msgbox(0,"test",Guictrlread($Input & $i))

$i+=1

next

It's like this in C#

Console.WriteLine("Values: {0}, {1}", val1.Value, val2.Value)

Edited by Dizzydbd
Link to comment
Share on other sites

How can i do smth like this (hard for me to explain but i'll try; it is possible in C with %i% or smth like that)

For $i = 1 to 4

Msgbox(0,"test",Guictrlread($Input & $i))

$i+=1

next

It's like this in C#

Console.WriteLine("Values: {0}, {1}", val1.Value, val2.Value)

Untested:

For $i = 1 To 4
    $sActiveInput = Eval("input" & $i)
    If $sActiveInput <> "" Then
        MsgBox(0, "test", GUICtrlRead($sActiveInput))
    EndIf
Next

Also, there's no need to do the $i+=1 in your For...Next loop unless you're intending to skip every other result.

Ex:

First run $i = 1

MsgBox... yada yada

Increment $i ($i = 2)

Second run, For...Next increments, changing $i to 3, so $input2 is skipped...

Edit: in explaining about "skipping," I, uh, skipped entering the word itself :D

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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