Sign in to follow this  
Followers 0
Tokie

Random Var

6 posts in this topic

ok well ive looked threw the help file and i guess im just retarted but heres what im wanting to do it tak e the send command and have it insert a random string that ive created im farely new to autoit and a little help would be nic e if i not mistaking i do beleave i ahve to dim my random text as something but lets say i

dim $A = its only the end, $B = sorry your to late , $C = One more time

ok now how do i get it ot send the mat random and their will be a lot more strings than that i m looking at about 50 right now and i need it ot be used with the send command

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Arrays always make this kind of things easier.

Dim $words[3]
$words[0]= "its only the end"
$words[1]= "sorry you'RE to late"
$words[2]= "One more time"

MsgBox(0,"",$words[Random(0,2,1)])
Edited by Nahuel

Share this post


Link to post
Share on other sites

i want to thank you Nahuel for the fast reply but i dont think that will work for what i m wanting ot do heres the code im using

#Include <IE.au3>
$oIE= _IECreate ("www.google.com")
_IENavigate($oIE,"www.yahoo.com")
Sleep(3000) 
MouseClick(" left",300,188,1)
sleep(3000)

waht that dos e it opens my IE and clicks on the yahoo search bar and i want it to search for random things if possible but i want the random to be fro ma list that i have created is this possiable at all ? if so waht would i use with the send code ?

Share this post


Link to post
Share on other sites

You could make a list in a file like this:

item one

itme two

etc.

Then use _FileReadToArray() and you'll be able to use my suggestion.

Share this post


Link to post
Share on other sites

so it would be like this then right

#include <File.au3>
_FileReadToArray ( $sC:\Documents and Settings\buddy\My Documents\Updater\New Text document.txt, $aArray )

then in the text tifle i need this ? code

Dim $words[3]
$words[0]= "its only the end"
$words[1]= "sorry you'RE to late"
$words[2]= "One more time"

Or am i missing something

Share this post


Link to post
Share on other sites

Yes, look at this example:

#include <File.au3>
Dim $aArray
_FileReadToArray (@MyDocumentsDir & "\Updater\New Text document.txt", $aArray )
$i=Random(1,$aArray[0],1)
$RandomListItem=$aArray[$i]
MsgBox(0,"",$RandomListItem)

New text document.txt

Item one
Item two
Item three
Item Four

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  
Followers 0