Sign in to follow this  
Followers 0
MasterRaistlin

Concatenate Variable Names?

6 posts in this topic

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?

Share this post


Link to post
Share on other sites



GuiCtrlSetData takes a control handle, not just a name. You can try something like this.

$iIndex = 6

For $x = 1 to $iIndex

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

Next

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

maybe.. not enough info because currently..

$sTempSymbolInput

is not an Autoit known control that you can set the data to

8)

little late... lol

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

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