RandomGuest Posted September 8, 2007 Share Posted September 8, 2007 (edited) How can I make so when I push a button the script will chose 1 of 100 different texts and show one of them in notepad? (I read the random thing in the manual, didnt understand it tho ) Edited September 9, 2007 by RandomGuest Link to comment Share on other sites More sharing options...
Generator Posted September 8, 2007 Share Posted September 8, 2007 Declare an array..Add texts as elements in it..Then random a # from 0-99 and use as array's index..rest you know Link to comment Share on other sites More sharing options...
RandomGuest Posted September 9, 2007 Author Share Posted September 9, 2007 Hmm...im quite new to AutoIt, so I dunno what you are talking about , can you give me a example? Link to comment Share on other sites More sharing options...
rambo3889 Posted September 9, 2007 Share Posted September 9, 2007 (edited) An array is just a way to hold more information in an array. dim $yourarray[10];10 is the number of "variabels" we want in our array , starting from zero $yourarray[0]="one";you can now access this text by using $yourarray[0] $yourarray[1]="two" $yourarray[2]="three" ;So to get some random text: msgbox(0,"",$yourarray[random(0,3)]);if random returns 0 the msgbox will say one, if 1 then it will say two if 2 it will say three Edited September 9, 2007 by rambo3889 My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
ssubirias3 Posted September 9, 2007 Share Posted September 9, 2007 Hmm...im quite new to AutoIt, so I dunno what you are talking about , can you give me a example?You did read the Help file example for Random() and Dim where it also talks about arrays? Help file example code for Random() ;Random letter If Random() < 0.5 Then ;Capitals $Letter = Chr(Random(Asc("A"), Asc("Z"), 1)) Else ;Lower case $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) Endif Link to comment Share on other sites More sharing options...
RandomGuest Posted September 9, 2007 Author Share Posted September 9, 2007 (edited) An array is just a way to hold more information in an array. dim $yourarray[10];10 is the number of "variabels" we want in our array , starting from zero $yourarray[0]="one";you can now access this text by using $yourarray[0] $yourarray[1]="two" $yourarray[2]="three" ;So to get some random text: msgbox(0,"",$yourarray[random(0,3)]);if random returns 0 the msgbox will say one, if 1 then it will say two if 2 it will say threeHow can I make so the text(one,two,three) shows in notepad and not in a messagebox? Thanks btw Edited September 9, 2007 by RandomGuest Link to comment Share on other sites More sharing options...
RandomGuest Posted September 9, 2007 Author Share Posted September 9, 2007 Bump Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 9, 2007 Moderators Share Posted September 9, 2007 (edited) If it must display in an "open" window, look at ControlSetText() or ControlSend() to set/send the information. If it's something you just want to open with the data showing, look at FileWrite()+ShellExecute(). P.S. You've been here, a part of this forum for 6 months, that's more than enough time for knowing the basic questions as you have presented in this post. Show some effort next time, just saying you are "new" doesn't make you immune to reading and comprehending the help file, it's an insult to those of us that have spent a lot of our time to learn what it is that we need to know, to accomplish what we want to achieve. Edited September 9, 2007 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...
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