Jump to content

Concatenate Variable Names?


Recommended Posts

I've experimented with this but it still doesn't work so I'm wondering if it's even possible. Here's the rundown of what I want to do:(note..not exact code)

$iIndex = 6

For $x = 1 to $iIndex

$sTempSymbolInput = $SymbolInput & $x   ; Wanting end result of $sTempSymbolInput to be $SymbolInput1
GuiCtrlSetData($sTempSymbolinput, $symArray[$x - 1])

Next

Is it clear what I'm trying to do? Is this possible or is there another function I can call from within AutoIt?

Link to comment
Share on other sites

Sorry..I guess I should have been more specific.....

$SymbolInput($x) are a bunch of different input boxes (so called SymbolInput1, SymbolInput2, etc) I have on my GUI and, at the time of running this function, would contain nothing. So what I want to do is, when the user starts this certain function, would load the data in sequence from $symArray and put it into the Input boxes for use in another part of the program (yes..I do need them to be displayed in the Input boxes for the user in this case)

Link to comment
Share on other sites

Sorry..I guess I should have been more specific.....

$SymbolInput($x) are a bunch of different input boxes (so called SymbolInput1, SymbolInput2, etc) I have on my GUI and, at the time of running this function, would contain nothing. So what I want to do is, when the user starts this certain function, would load the data in sequence from $symArray and put it into the Input boxes for use in another part of the program (yes..I do need them to be displayed in the Input boxes for the user in this case)

Why not keep those input boxes in turn in their own array: Instead of variable names with numbers, why not array indexes? I have a user management script that reads the list of users (don't know how many in advance), and then presents a gui to select them by check boxes for action. The list of users is an array, the list of ceckbox control IDs is a matching array where the index for the user matches the index for the control ID of that user's checkbox (can also be done with a single multi-dimensional array).

When I started out in AuotIT, I ran quickly into situations I thought required "variable-named variables". But a re-think has always pointed me to arrays as a better solution. Any reason why it won't work for you?

:)

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
Link to comment
Share on other sites

Well, there's two ways to do it. The way I would do it, is:

Dim $SymbolInput[10]
For $i = 0 To 9
    $SymbolInput[$i] = GUICtrlCreateInput(...)
Next
oÝ÷ Ù:&jG­á +kƥDz'«Êjyæ§jºÚÊ%v)නÿ*h²+b¢{(}©e¶¢{k¢[.W¬²Ø^Ëky©ez÷§+)iÇ¢»(ëax*.Á©í¶z¨º±!ÊÞjبÊzØ^±©Â+aéz»·uçbØ^½ªâi¹^©kyÊ&éÝyÛaz|¨¹Æ§v(ëax%G­+ºÚ"µÍÜ  ÌÍÚHHHÈL    ÌÍÝ[Þ[XÛ[]H][
    ][ÝÔÞ[XÛ[]  ][ÝÈ  [È ÌÍÚJBÈÈÝYB^

Happy hunting!

Edit: @PsaltyDS: too quick for me!

Edited by neogia

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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