gauss5546 Posted January 12, 2008 Share Posted January 12, 2008 i was wondering how i could make a script that types up an 8-digit random number. e.x. 32459812 Link to comment Share on other sites More sharing options...
WolfWorld Posted January 12, 2008 Share Posted January 12, 2008 Global = $sRandom For $i = 1 to 8 $sRandom &= Random(0,9,1) next Send($sRandom) Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Danp2 Posted January 12, 2008 Share Posted January 12, 2008 $sRandom = StringFormat("%08u", Random(0,99999999,1)) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 12, 2008 Share Posted January 12, 2008 You don't use = for global Or use the other code Global $sRandom For $i = 1 to 8 $sRandom &= Random(0,9,1) next Send($sRandom) Link to comment Share on other sites More sharing options...
martin Posted January 12, 2008 Share Posted January 12, 2008 The answers above are not going to guarantee an eight digit number which the OP asked for. You either need $ans = Random(10000000,99999999,1) or using the loop idea $ans = random(1,9,1) for $n = 1 to 7 $ans &= random(0,9,1) next 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...
gauss5546 Posted January 14, 2008 Author Share Posted January 14, 2008 ok thanks I'll try it out! Link to comment Share on other sites More sharing options...
therks Posted January 14, 2008 Share Posted January 14, 2008 The answers above are not going to guarantee an eight digit number which the OP asked for.Do you refer to post #3? Cus it will. Unless you don't count 00000000, in which case it's just a difference of opinions. $sRandom = StringFormat("%08u", Random(0,99999999,1)) MsgBox(0,0,$sRandom)oÝ÷ غ(Ébï'ºfÞ®Ëhá/z{aÆ®¶sbb33c·5&æFöÒÒ7G&ætf÷&ÖBgV÷C²SRgV÷C²Â¤×6t&÷ÃÂb33c·5&æFöÒ Is technically 8 numbers. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
martin Posted January 14, 2008 Share Posted January 14, 2008 Do you refer to post #3? Cus it will. Unless you don't count 00000000, in which case it's just a difference of opinions. $sRandom = StringFormat("%08u", Random(0,99999999,1)) MsgBox(0,0,$sRandom)oÝ÷ غ(Ébï'ºfÞ®Ëhá/z{aÆ®¶sbb33c·5&æFöÒÒ7G&ætf÷&ÖBgV÷C²SRgV÷C²Â¤×6t&÷ÃÂb33c·5&æFöÒ Is technically 8 numbers. Yes, zero is a digit so maybe I'm wrong. I personally wouldn't accept 01 or 00 as being 2 digit numbers, but I would accept them as a 2-digit strings. 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...
gauss5546 Posted January 18, 2008 Author Share Posted January 18, 2008 I have found that this script is most effective for what I needed. CODEGlobal $sRandom For $i = 1 to 8 $sRandom &= Random(0,9,1) next Send($sRandom) However, now I need the random number to be between 10000000 and 37000000. Thank You to everyone who tried to help me out previously. Link to comment Share on other sites More sharing options...
weaponx Posted January 18, 2008 Share Posted January 18, 2008 Read the help file. Random(10000000,37000000, 1) 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