RyGoTypE Posted November 8, 2006 Share Posted November 8, 2006 How would I exactly go about doing a random function with random amounts? Example: I want to Send random letters a-z caps and non caps a random amount of times. "saSADGTagwEddwDWdd" "wdwDWd" "erjtTJGgrgreGERgh" Something like that? http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2006 Moderators Share Posted November 8, 2006 How would I exactly go about doing a random function with random amounts?Example: I want to Send random letters a-z caps and non caps a random amount of times."saSADGTagwEddwDWdd" "wdwDWd""erjtTJGgrgreGERgh"Something like that?loopvar &= Chr(Random(asc(), asc(), 1)) 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...
RyGoTypE Posted November 8, 2006 Author Share Posted November 8, 2006 loop var &= Chr(Random(asc(), asc(), 1)) This is what I currently have. ControlSend($handle, "", "", Chr(Random(Asc("a"), Asc("z"), 1))) That is only sending a random lowercase letter one time. I would like it to send a mix of upper and lowercase randomly with a random amount of times. "saSADGTagwEddwDWdd" "wdwDWd" "erjtTJGgrgreGERgh" Something like that? http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2006 Moderators Share Posted November 8, 2006 (edited) This is what I currently have. ControlSend($handle, "", "", Chr(Random(Asc("a"), Asc("z"), 1))) That is only sending a random lowercase letter one time. I would like it to send a mix of upper and lowercase randomly with a random amount of times. "saSADGTagwEddwDWdd" "wdwDWd" "erjtTJGgrgreGERgh" Something like that?I gave you the answer. Did you miss the "loop" part before controlsend() and holding the values in var? Edit: Global $sRanText For $iCC = 1 To Random(5, 15, 1) Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next MsgBox(64, 'Info', $sRanText) Edited November 8, 2006 by SmOke_N 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...
RyGoTypE Posted November 8, 2006 Author Share Posted November 8, 2006 Doesn't seem to be working. I must be doing something wrong. Is there any other way? http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
RyGoTypE Posted November 8, 2006 Author Share Posted November 8, 2006 I took your code and made it so it would output for my needs and I still only get one lowercase letter. Global $sRanText For $iCC = 1 To Random(5, 15, 1) Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next ControlSend($handle, "", "", $sRanText) http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2006 Moderators Share Posted November 8, 2006 I took your code and made it so it would output for my needs and I still only get one lowercase letter. Global $sRanText For $iCC = 1 To Random(5, 15, 1) Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next ControlSend($handle, "", "", $sRanText)What happens when you use raw mode? What are you doing anyway? 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...
tresa Posted November 8, 2006 Share Posted November 8, 2006 I took your code and made it so it would output for my needs and I still only get one lowercase letter. Global $sRanText For $iCC = 1 To Random(5, 15, 1) Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next ControlSend($handle, "", "", $sRanText)Try with this you'll see it works. I prefered put the length in a var as I do'nt know how the compiler do with a function call in the upper limit of the For statement. Does it call the func each time or is smart enough to put it in a register? Global $sRanText,$length while 1 $length=Random(5, 15, 1) For $iCC = 1 To $length Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next ConsoleWrite($sRanText & @CRLF) $sRanText='' Sleep(4000) Wend Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2006 Moderators Share Posted November 8, 2006 I prefered put the length in a var as I do'nt know how the compiler do with a function call in the upper limit of the For statement. [/autoit]Always one way to find out. Also your loop doesn't address his issue with it only sending lower case (Unless he only tried it once, and that's what the Random chars produced), that's the only thing different other than the var as I presented. 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...
tresa Posted November 8, 2006 Share Posted November 8, 2006 (edited) Always one way to find out. Also your loop doesn't address his issue with it only sending lower case (Unless he only tried it once, and that's what the Random chars produced), that's the only thing different other than the var as I presented.The issue is that he is using after a send cmd which takes only the first char of the wordExcuse it's not true. I thought about hoykeysetOtherwise, what do you mean with 'Always one way to find out.'? Edited November 8, 2006 by tresa Link to comment Share on other sites More sharing options...
RyGoTypE Posted November 8, 2006 Author Share Posted November 8, 2006 Try with this you'll see it works. I prefered put the length in a var as I do'nt know how the compiler do with a function call in the upper limit of the For statement. Does it call the func each time or is smart enough to put it in a register? Global $sRanText,$length while 1 $length=Random(5, 15, 1) For $iCC = 1 To $length Switch Random(1, 2, 1) Case 1 $sRanText &= Chr(Random(Asc('a'), Asc('z'), 1)) Case 2 $sRanText &= Chr(Random(Asc('A'), Asc('Z'), 1)) EndSwitch Next ConsoleWrite($sRanText & @CRLF) $sRanText='' Sleep(4000) Wend Even with the idea you have given me, it still only sends one lowercase letter. http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
WhiteTiger Posted November 8, 2006 Share Posted November 8, 2006 (edited) does it have to be unique ? if not , then $var = random() $rand = _stringtohex($var) msgbox(0,"",$rand &"There you go !") Edited November 8, 2006 by WhiteTiger Link to comment Share on other sites More sharing options...
tresa Posted November 8, 2006 Share Posted November 8, 2006 Even with the idea you have given me, it still only sends one lowercase letter.to debug put a consolewrite statement just before controlsend to check $sRanText valueOtherwise, controlsend wait for a window title not an handle?And you do'nt specify a controlName Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2006 Moderators Share Posted November 8, 2006 (edited) Why not just use ControlSetText? Edit: And @tresa "One way to find out" Compile it and find out for yourself if you don't know what it will do. Edit2: @rygotype Maybe look for ControlSendPlus() as well... you still haven't explained what you want this for, all I can think now is how I get these random names on my forum spam Edited November 8, 2006 by SmOke_N 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...
RyGoTypE Posted November 9, 2006 Author Share Posted November 9, 2006 Global $handle = WinGetHandle("classname=GxWindowClassD3d") http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 9, 2006 Moderators Share Posted November 9, 2006 Global $handle = WinGetHandle("classname=GxWindowClassD3d")Using Opt('WinTitleMatchMode', 4) as well I'm sure? 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...
RyGoTypE Posted November 9, 2006 Author Share Posted November 9, 2006 AutoItSetOption("WinTitleMatchMode", 4) http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 9, 2006 Moderators Share Posted November 9, 2006 AutoItSetOption("WinTitleMatchMode", 4)Ok, so now we've played the cat and mouse game for 15 posts. It's time (if you want an actual solution) to do the following:1. Post a replication script that is similar to what you are currently doing (A working example, don't waste your time with anything else)2. If there are 3rd party programs involved then provide what they are, links to them if they aren't common, or if it's browser based provide a link they can be interacted with properly.3. If there are passwords involved, make a dummy account so that the issue can be tested on this end as well.You asked a question, you received the answer, anything else is a guessing game. If you can't provide the information to us to help you, then you need to figure it out on your own. 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...
Cue Posted November 9, 2006 Share Posted November 9, 2006 #include <Misc.au3> $string="" for $i=1 to Random ( 1,30,1 ) $string&=_Iif ( random(0,1,1), chr(Random(65,90,1)), chr(Random(97,122,1)) ) Next send($string,1) I didnt quite follow some of the posts so i dont know if you already have the answer to your original question if so please ignore this post. Link to comment Share on other sites More sharing options...
Cue Posted November 9, 2006 Share Posted November 9, 2006 Ive set a limit of 30 characters BTW you can simply change this 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