# Help needed in Automation And Ramdom Timinings.

## Recommended Posts

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 on other sites

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 on other sites

You mean the time between the clicks?

Just do this:

What about more than one clicks?

##### 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 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 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 on other sites

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

## Create an account

Register a new account

×

• Wiki

• Back

• Git