Sign in to follow this  
Followers 0
Abdullah

Help needed in Automation And Ramdom Timinings.

9 posts in this topic

Hi. I am new and basically. I needed some help in writing a script. I want to make three clicks at certian places of the screen. (10, 10). (50, 50). & (100, 100)

but the time has to be randomized.. can anybody tell me how to do that? Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You mean the time between the clicks?

Just do this:

$random_time = Random(1,10,1); This will generate a random integer number between 1 and 10

MouseClick("left",10,10)

Sleep($random_time)

.

.

.

Edited by pedmacedo

Share this post


Link to post
Share on other sites

You mean the time between the clicks?

Just do this:

What about more than one clicks?

Share this post


Link to post
Share on other sites

What about more than one clicks?

Between two clicks it: i wrote it like this:

Exaple.

$random_time = Random(1,10,1); This will generate a random integer number between 1 and 10

MouseClick("left",10,10)

MouseClick("left",20,10)

MouseClick("left",30,10)

MouseClick("left",40,10)

MouseClick("left",50,10)

Sleep($random_time)

And it is just keep clicking one after another no wait ;(

Share this post


Link to post
Share on other sites

What about more than one clicks?

Just use the Random function again.

$random_time = Random(1,10,1);

MouseClick("left",10,10)

Sleep($random_time)

$random_time = Random(1,10,1);

MouseClick("left",50,50)

Sleep($random_time)

MouseClick("left",100,100)

$random_time = Random(1,10,1);

Sleep($random_time)

Share this post


Link to post
Share on other sites

Just use the Random function again.

Thxs.. a lot.. but is there any way? I can set the random seconds too?

Seconds for 10sec - 2mins.?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Sleep() takes milliseconds as a parameter. So Sleep(1000) 'sleeps' for 1 second.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Hope this helps:

HotKeySet('{ESC}', '_Exit')

Local $Coordinates[3][2] = [[10, 10],[50, 50],[100, 100]]   ;Array for coordinates 10,10 50,50 100,100

While 1
    For $i = 0 To UBound($Coordinates) - 1
        Local $Random_Time = Random(1, 10, 1); This will generate a random integer number between  and 10
        MouseClick("left", $Coordinates[$i][0], $Coordinates[$i][1])
        Sleep($Random_Time * 1000) ;From 1 Second to 10 Seconds
    Next
WEnd

Func _Exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Doing my DAMNDEST to think of a legit need for this ?!?!?!?


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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