reecieboy Posted September 29, 2011 Share Posted September 29, 2011 (edited) Are "variable variables" possible... I believe thats what they're called Local $var = "Product" Local $num = 1 ;GUICtrlRead($Product_Number) if StringIsAlNum($num) Then $var & $num = "Info" MsgBox(0, "", $Product1) EndIf a variable is set from the value of both $var and $num creating $Product1 I appreciate any help on this matter as it would help me use alot less code in my current project. Thanks in advance Edited September 29, 2011 by reecieboy Link to comment Share on other sites More sharing options...
Shaggi Posted September 29, 2011 Share Posted September 29, 2011 Through string manipulation... Ie. Eval(), Assign(), Execute() etc. Local $var = "Product" Local $num = 1 ;GUICtrlRead($Product_Number) if StringIsAlNum($num) Then Assign($Var & $Num, "Info") MsgBox(0, "", $Product1) EndIf Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 29, 2011 Share Posted September 29, 2011 You can do that with Assign(), but that's rarely a good solution. Instead, look at using array(s) to store the data. There's a Array tutorial in the wiki that may be of your interest. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
reecieboy Posted September 29, 2011 Author Share Posted September 29, 2011 Thanks to both. My intention is that i have multiple gui controls with similar handles for example $Product1 $Product2 $Product3 so on an so forth.. so i really need to GUICtrlRead($var & $num) if you know what i mean, I forsee that not being possible with Assign Link to comment Share on other sites More sharing options...
Shaggi Posted September 29, 2011 Share Posted September 29, 2011 (edited) Thanks to both. My intention is that i have multiple gui controls with similar handles for example $Product1 $Product2 $Product3 so on an so forth.. so i really need to GUICtrlRead($var & $num) if you know what i mean, I forsee that not being possible with AssignGuiCtrlRead(Eval($Var & $Num))There ya go. Edited September 29, 2011 by Shaggi Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG Link to comment Share on other sites More sharing options...
reecieboy Posted September 29, 2011 Author Share Posted September 29, 2011 Thank you very much shaggi, really do appreciate your time.. Link to comment Share on other sites More sharing options...
hannes08 Posted September 29, 2011 Share Posted September 29, 2011 As AdmiralAlkex already stated, it would be a better idea to use arrays here: Dim $array[6] $array[0] = 5 For $i = 1 To $array[0] $array[$i] = GuiCtrlCreateInput("...") Next ;and later on: For $i = 1 To $array[0] GuiCtrlRead($array[$i]) Next Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
czardas Posted September 29, 2011 Share Posted September 29, 2011 (edited) On a side note, which may be of interest. With AutoIt, many operations will convert a number to a string automatically, and vice versa. For example the use of the operator &= will concatenate two numbers and return a string. It makes a lot of coding easier, but it can be confusing sometimes. The functions Number() and String() are sometimes needed to alter the variable type. Edited September 29, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now