Jump to content
Sign in to follow this  
RandomGuest

Random + Notepad thing...

Recommended Posts

RandomGuest

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 by RandomGuest

Share this post


Link to post
Share on other sites
Generator

Declare an array..Add texts as elements in it..Then random a # from 0-99 and use as array's index..rest you know

Share this post


Link to post
Share on other sites
RandomGuest

Hmm...im quite new to AutoIt, so I dunno what you are talking about :), can you give me a example?

Share this post


Link to post
Share on other sites
rambo3889

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 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!

Share this post


Link to post
Share on other sites
ssubirias3

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

Share this post


Link to post
Share on other sites
RandomGuest

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
How can I make so the text(one,two,three) shows in notepad and not in a messagebox?

Thanks btw :)

Edited by RandomGuest

Share this post


Link to post
Share on other sites
RandomGuest

Bump

Share this post


Link to post
Share on other sites
SmOke_N

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 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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×