GodForsakenSoul Posted March 10, 2008 Share Posted March 10, 2008 (edited) i decided to make a random word generator, but i can't seem to be able to do ANYTHING without screwing up alot. here's the general idea, i got angry and deleted the code so now all that is left is the idea. XD dim $1=0 dim $11=0 $1=random([0, [26]]) select case $1=0 $11=*space* case $1=1 $11=a case $1=2 $11=b <repeat till you reach "case $1=26"> one letter isn't really a word, but it's a start. and i'm failing miserably at it. this simple (though long) piece of code seems to be full of some error because it hates the following line case $1=1 $11=a and according to the help file, i can put as many cases as i want. where am i going wrong and how do i fix? Edited March 10, 2008 by GodForsakenSoul Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2008 Moderators Share Posted March 10, 2008 (edited) Strings have to be wrapped in quotes... $11 = "b" not $11 = b. Here's an example on something you might try:Local $a, $b While StringLen($a & $B) < 10;Do a loop until the desired length is there Switch Random(0, 26, 1) Case 0 $b &= "a" Case 1 $b &= "b" Case 2 $a &= "zz" Case 3 $a &= "yy" Case Else;Obviously you would continue on from the above $a &= "m" EndSwitch WEnd MsgBox(0, 0, $a & $B) Edited March 10, 2008 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...
spudw2k Posted March 10, 2008 Share Posted March 10, 2008 (edited) You could make it simplier by using ASCII Codes. dim $a dim $b $a = Random(0,26) If $a = 0 Then $b = Chr(32) ;ASCII Code for Space Else $b = Chr($a + 96) ;97 - 122 = a - z | 65 - 90 = A - Z EndIf msgbox(0,"",$B) Edited March 10, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
GEOSoft Posted March 10, 2008 Share Posted March 10, 2008 (edited) i decided to make a random word generator, but i can't seem to be able to do ANYTHING without screwing up alot. here's the general idea, i got angry and deleted the code so now all that is left is the idea. XD dim $1=0 dim $11=0 $1=random([0, [26]]) select case $1=0 $11=*space* case $1=1 $11=a case $1=2 $11=b <repeat till you reach "case $1=26"> one letter isn't really a word, but it's a start. and i'm failing miserably at it. this simple (though long) piece of code seems to be full of some error because it hates the following line case $1=1 $11=a and according to the help file, i can put as many cases as i want. where am i going wrong and how do i fix? $1=random([0, [26]]) ?????????????????????? When you see the "[" and "]" used in the help file they are being used to show optional parameters. $1 = random(1, 26, 1) But for just the alphabet you could also use $1 = random(97, 122, 1) Edited March 10, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
LinuZ Posted March 10, 2008 Share Posted March 10, 2008 Do you mean something like 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