IHI.II.IIVII. Posted May 28, 2006 Share Posted May 28, 2006 I want to random between a set of letters I want to send. "Y", "O", and "U" are the letters. If you don't understand what I am asking, please tell me. Link to comment Share on other sites More sharing options...
mr.underperson Posted May 28, 2006 Share Posted May 28, 2006 So create an array, each element being one letter. Then create a $random_number. Then simply spit out $array[$random_number]. -mu Link to comment Share on other sites More sharing options...
IHI.II.IIVII. Posted May 28, 2006 Author Share Posted May 28, 2006 Could you write out the actually script for me, array junk is new to me. Link to comment Share on other sites More sharing options...
mr.underperson Posted May 28, 2006 Share Posted May 28, 2006 Could you write out the actually script for meSure, simply deposit $100 in my PayPal account and I'll get right to it, sir.array junk is new to me.At one time, it was new to me, too.Try searching the manual for "junk", or whatever, it's filled with useful examples.This forum also has a search facility.-mu Link to comment Share on other sites More sharing options...
4gotn1 Posted May 28, 2006 Share Posted May 28, 2006 Sure, simply deposit $100 in my PayPal account and I'll get right to it, sir.At one time, it was new to me, too.Try searching the manual for "junk", or whatever, it's filled with useful examples.This forum also has a search facility.-mui'll do it for $95.99 ^.^ lol Link to comment Share on other sites More sharing options...
Lakes Posted May 28, 2006 Share Posted May 28, 2006 i'll do it for $95.99 ^.^ lol You need to look at using StringSplit (with no delimiter) with all the letters of the alphabet in the string. So if your String is "ABCDEF" then StringSplit wil return an array with each element being a letter. So the element in $Array[1] would be A, in $Array[2] would be B etc Then you need to use the Random function to generate a number between 1 and 26 and make this a variable to pick a letter from the array, like this $Letter = $Array($Random) Use _StringInsert to put this letter back into your original string. Read the Helpfile, look at the examples, post some code here. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 28, 2006 Share Posted May 28, 2006 Hi, maybe this helps a bit : Dim $letter_A[3] = ['Y','O','U'] For $i=0 To 5 MsgBox(0,$i, $letter_A[Random(0,UBound($letter_A)-1, 1)]) Next So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
herewasplato Posted May 28, 2006 Share Posted May 28, 2006 I want to [add/insert] random [letters/numbers/both?] between a set of letters I want to send. "Y", "O", and "U" are the letters. If you don't understand what I am asking, please tell me.I'm not sure that I understand what you want - hence my edit of your quoted post. Try this:MsgBox(0, "", _SendRandomStuff("CAN YOU CODE", 3, 11)) ;Send(_SendRandomStuff("CAN YOU CODE", 3, 11)) Func _SendRandomStuff($var, $min, $max) Local $varARRAY = StringSplit($var, "") Local $SRS = "" For $i = 1 To $varARRAY[0] Local $stuff = "" For $ii = 1 to (Random($min, $max, 1)) $stuff = $stuff & Chr(Random(Asc("a"), Asc("z"), 1)) Next $SRS = $SRS & $varARRAY[$i] & $stuff Next Return $SRS EndFunc ;==>_SendRandomStuffThe MsgBox is just for ease of testing. Comment it out and uncomment the "Send" line. You can change the "3" and the "11" when you call the UDF. For the example above, 3 is the minimum number of lower cased letters that the UDF will insert between your letters... 11 is the maximum number inserted. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 28, 2006 Moderators Share Posted May 28, 2006 @plato - You're a better man than I if that is what he actually wants. I have read that thing 10 x's and still don't get it, and example on his part would have been great, I was assuming he only wanted to shuffle Y/O/U ... but that makes no sense either . Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Simucal Posted May 28, 2006 Share Posted May 28, 2006 Seriously. The trend lately seems to be: "How can I ask a question in the most cryptic way possible and provide the least amount of relevant examples/information at the same time?" AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
herewasplato Posted May 29, 2006 Share Posted May 29, 2006 ...I was assuming he only wanted to shuffle Y/O/U ... but that makes no sense either .Thanks... In case the OP only wants to scramble: http://www.autoitscript.com/forum/index.ph...indpost&p=53837 [You might have to "Tidy" the Or_ to Or _] :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
mr.underperson Posted May 29, 2006 Share Posted May 29, 2006 Seriously. The trend lately seems to be: "How can I ask a question in the most cryptic way possible and provide the least amount of relevant examples/information at the same time?"Very observant, and also very true. I read (another) post on this forum over ten times earlier today, trying to figure out what the poster wanted (which *looked* like it would have been easy) before just giving up.To my mind, it's the one asking the question that should be doing the leg-work, examples, sample code, clearly defining the task and goal, etc. But usually it takes umpteen posts from other members to even establish these basics.crazy.-mu Link to comment Share on other sites More sharing options...
JoshDB Posted May 29, 2006 Share Posted May 29, 2006 (edited) I want to random between a set of letters I want to send. "Y", "O", and "U" are the letters. If you don't understand what I am asking, please tell me. I think he means that he wants to send three sets of random letters between Y, O, and U. $Letters = 5 ; Number of letters between Y, O, and U. Global $Result For $i = 1 To $Letters*2 $Result = $Result & Chr(Random(65,90,1)) Next $Result = "Y" & StringLeft($Result,$Letters) & "O" & StringRight($Result,$Letters) & "U" MsgBox(0,"Result",$Result) Edited May 29, 2006 by JoshDB Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite Link to comment Share on other sites More sharing options...
herewasplato Posted May 29, 2006 Share Posted May 29, 2006 ...between Y, O, and U...I like your use of Chr(Random(65,90,1)) and I thought of using it, but was too lazy to look up the numbers... I did not pay much attention to the word "between".While 1 MsgBox(0, "", _SendRandomStuff("YOU", 4, 22)) WEnd Func _SendRandomStuff($var, $min, $max) Local $varARRAY = StringSplit($var, "") Local $SRS = "" For $i = 1 To ($varARRAY[0] - 1) Local $stuff = "" For $ii = 1 to (Random($min, $max, 1)) $stuff = $stuff & Chr(Random(Asc("!"), Asc("~"), 1)) Next $SRS = $SRS & $varARRAY[$i] & $stuff Next Return $SRS & StringRight($var, 1) EndFunc ;==>_SendRandomStuff [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
JoshDB Posted May 29, 2006 Share Posted May 29, 2006 Well I'm glad that was cleared up... Since you did it yourself... Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite Link to comment Share on other sites More sharing options...
IHI.II.IIVII. Posted May 29, 2006 Author Share Posted May 29, 2006 To everyone who doesn't understand, I'm sorry. Example of what I want. Send($var) $var = Y, O, U (one of the three letters) I would like the letter it sends to be random between the three. Link to comment Share on other sites More sharing options...
slightly_abnormal Posted May 29, 2006 Share Posted May 29, 2006 (edited) Maybe.. DIm $Y[4] $Y[1]=Send('Y') $Y[2]=Send('O') $Y[3]=Send('U') For $i= 1 to 3 Send(Random($Y[1],$Y[$i])) Next "YOU000"... very random haha well.. i thought it would work. :/ Edited May 29, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
The Kandie Man Posted May 29, 2006 Share Posted May 29, 2006 Maybe.. Dim $Y[4] $Y[1]=Send('Y') $Y[2]=Send('O') $Y[3]=Send('U') For $i= 1 to 3 Send(Random($Y[1],$Y[$i])) Next "YOU000"... very random haha well.. i thought it would work. :/ You had the right idea, i just edited your code a bit: hotkeyset("{end}","terminate") sleep(2000) DIm $Y[4] $Y[1]='Y' $Y[2]='O' $Y[3]='U' While 1 Send($Y[Random(1,3,1)]) sleep(30) Wend Func terminate() Exit Endfunc Press the End key to make it stop. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
herewasplato Posted May 29, 2006 Share Posted May 29, 2006 ...I would like the letter it sends to be random between the three.Stealing code from those above, try just these two lines:$Y = StringSplit("YOU", "") Send($Y[Random(1, 3, 1)]) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
IHI.II.IIVII. Posted May 31, 2006 Author Share Posted May 31, 2006 Stealing code from those above, try just these two lines:$Y = StringSplit("YOU", "") Send($Y[Random(1, 3, 1)]) Perfect! Thanks to everyone that helped 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