totoymola Posted May 22, 2006 Posted May 22, 2006 (edited) $Number = Chr(Random(48, 57 ,1));--- ASCII Characters 0 to 9 $Upper = Chr(Random(65, 90, 1));--- ASCII Characters A to Z $Lower = Chr(Random(97, 122, 1));--- ASCII Characters a to z $X = $Number Or $Upper Or $Lower;--- ASCII Characters 0 to 9, A to Z, or a to z MsgBox(0, "Random Alpha-Numeric Character", $X) I want AutoIt to generate a random alpha-numeric character (numbers, upper case letters, lower case letters). However, I am having problem in my 4th line. What is the proper way of doing this? Thanks! Edited May 22, 2006 by totoymola
CyberSlug Posted May 22, 2006 Posted May 22, 2006 A quick way; however, the distribution will not be exactly uniform (numbers would appear almost as frequently as letters): Dim $array[3] $array[0] = Chr(Random(48, 57 ,1)); ASCII Characters 0 to 9 $array[2] = Chr(Random(65, 90, 1)); ASCII Characters A to Z $array[1] = Chr(Random(97, 122, 1)); ASCII Characters a to z $X = $array[Random(0,2,1)] MsgBox(0, "Random Alpha-Numeric Character", $X) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
GaryFrost Posted May 22, 2006 Posted May 22, 2006 here's something from a couple of years ago, might help, might not MsgBox(0 , "Random Password", randompass("8")) Func RandomPass($length) Local $letter, $password If $length < 9 then For $i = 1 To $length $letter = Random(33, 126) $password = $password & Chr($letter) Next Return $password Else Return "Length too long" Endif Endfunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Moderators SmOke_N Posted May 22, 2006 Moderators Posted May 22, 2006 (edited) $Number = Chr(Random(48, 57 ,1));--- ASCII Characters 0 to 9 $Upper = Chr(Random(65, 90, 1));--- ASCII Characters A to Z $Lower = Chr(Random(97, 122, 1));--- ASCII Characters a to z $X = $Number Or $Upper Or $Lower;--- ASCII Characters 0 to 9, A to Z, or a to z MsgBox(0, "Random Alpha-Numeric Character", $X) I want AutoIt to generate a random alpha-numeric character (numbers, upper case letters, lower case letters). However, I am having problem in my 4th line. What is the proper way of doing this? Thanks! Are you trying to do something like:Dim $RandomChar[5] $RandomChar[1] = Chr(Random(48, 57, 1)); ASCII Characters 0 to 9 $RandomChar[2] = Chr(Random(65, 90, 1)); ASCII Characters A to Z $RandomChar[3] = Chr(Random(97, 122, 1)); ASCII Characters a to z $RandomChar[4] = Random(1, 3, 1) MsgBox(64, 'Info:', $RandomChar[$RandomChar[4]])oÝ÷ ØêÚºÚ"µÍÌÍÓ[XHÚ[ÛJ MËJJNÈTÐÒRHÚXÝÈÈBÌÍÕHÚ[ÛJ KLJJNÈTÐÒRHÚXÝÈHÈÌÍÓÝÙHÚ[ÛJMËLJJNÈTÐÒRHÚXÝÈHÈÌÍÖH ÌÍÓ[X [È ÌÍÕ [È ÌÍÓÝÙÈTÐÒRHÚXÝÈÈKHÈÜHÈÙÐÞ ][ÝÔ[ÛH[KS[YXÈÚXÝ][ÝË ÌÍÖ? Edit: Damn I'm slow!! Edited May 22, 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.
totoymola Posted May 22, 2006 Author Posted May 22, 2006 Awesome! Im gonna test them all and see which will fit my needs. Thanks a lot guys.
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