JD777 Posted May 13, 2008 Share Posted May 13, 2008 Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 GUICtrlSetData("$ca_inkey_in" & $clk,random_x(8)) <-------- I'm having a problem with this Until $clk = 4 I think this is my first post so hello everyone.I'm trying to write a script and am having a problem with this part of the script. What i'm trying to do is this: GUICtrlSetData($ca_inkey_in1,random_x(8)) GUICtrlSetData($ca_inkey_in2,random_x(8)) GUICtrlSetData($ca_inkey_in3,random_x(8)) GUICtrlSetData($ca_inkey_in4,random_x(8)) GUICtrlSetData($ca_inkey_in5,random_x(4)) Instead of writing all of this I wanted to know how to do this: ("$ca_inkey_in" & $clk) = $ca_inkey_in1 or 2 or 3 or 4 I hope someone can help or understand what I'm saying.Thanks in advance Link to comment Share on other sites More sharing options...
RyGoTypE Posted May 13, 2008 Share Posted May 13, 2008 (edited) Ehh, I'm not exactly sure what it is you want but from what I understood, you're looking for something like this? Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 GUICtrlSetData("$ca_inkey_in1" & $clk,Random(1, 8)) GUICtrlSetData("$ca_inkey_in2" & $clk,Random(1, 8)) GUICtrlSetData("$ca_inkey_in3" & $clk,Random(1, 8)) GUICtrlSetData("$ca_inkey_in4" & $clk,Random(1, 8)) GUICtrlSetData("$ca_inkey_in5" & $clk,Random(1, 4)) Until $clk = 4 Edited May 13, 2008 by RyGoTypE http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
martin Posted May 13, 2008 Share Posted May 13, 2008 (edited) Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 GUICtrlSetData("$ca_inkey_in" & $clk,random_x(8)) <-------- I'm having a problem with this Until $clk = 4 I think this is my first post so hello everyone.I'm trying to write a script and am having a problem with this part of the script. What i'm trying to do is this: GUICtrlSetData($ca_inkey_in1,random_x(8)) GUICtrlSetData($ca_inkey_in2,random_x(8)) GUICtrlSetData($ca_inkey_in3,random_x(8)) GUICtrlSetData($ca_inkey_in4,random_x(8)) GUICtrlSetData($ca_inkey_in5,random_x(4)) Instead of writing all of this I wanted to know how to do this: ("$ca_inkey_in" & $clk) = $ca_inkey_in1 or 2 or 3 or 4 I hope someone can help or understand what I'm saying.Thanks in advanceIf I understand correctly then you want this Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 Assign("ca_inkey_in" & $clk,random_x(8)) <-------- I'm having a problem with this Until $clk = 4 Edited May 13, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
JD777 Posted May 13, 2008 Author Share Posted May 13, 2008 (edited) If I understand correctly then you want this Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 GUICtrlSetData("$ca_inkey_in" & $clk,random_x(8)) <-------- I'm having a problem with this Until $clk = 4 yes thats the part i'm having problems with I want to use this ("ca_inkey_in" & $clk) as a variable that looks like $ca_inkey_inX with X being $clk so that this is result: $ca_inkey_in1 $ca_inkey_in2 $ca_inkey_in3 $ca_inkey_in4 etc... Thanks Edited May 13, 2008 by JD777 Link to comment Share on other sites More sharing options...
JD777 Posted May 13, 2008 Author Share Posted May 13, 2008 Oh yea I should have cleared this up: Case $ca_gen_Button1 $clk = 0 Do $clk = $clk + 1 GUICtrlSetData("$ca_inkey_in" & $clk, random_x(8)) <---------random_x(8) is a function my problem is "$ca_inkey_in" & $clk Until $clk = 4 Func random_x($fgennum = 0) $genkeyout = 0 $genkey = 0 For $i = 1 To $fgennum If Random() < 0.5 Then $genkey2 = Random(0, 10, 1) Else $genkey2 = Chr(Random(Asc("a"), Asc("z"), 1)) Endif $genkey = $genkey & $genkey2 Next $genkeyout = StringRight($genkey, $fgennum) Return $genkeyout EndFunc Link to comment Share on other sites More sharing options...
JD777 Posted May 13, 2008 Author Share Posted May 13, 2008 Thanks all I found out how to do this because martin pointed me in the right direction sort of.Heres what I did incase anyone else is interested: $clk = 0 Do $clk = $clk + 1 --------------->GUICtrlSetData(Eval("ca_inkey_in" & $clk),random_x(8)) <--------------------- Until $clk = 4 Func random_x($fgennum = 0) $genkeyout = 0 $genkey = 0 For $i = 1 To $fgennum If Random() < 0.5 Then $genkey2 = Random(0, 10, 1) Else $genkey2 = Chr(Random(Asc("a"), Asc("z"), 1)) Endif $genkey = $genkey & $genkey2 Next $genkeyout = StringRight($genkey, $fgennum) Return $genkeyout EndFunc This is going to help me tremendously in the future.Thanks again 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