Sign in to follow this  
Followers 0
EuphoricApathy

Looping random clicks within an area and stopping with ESC key

7 posts in this topic

The topic pretty much says it all...

Im starting to learn autoit for fun and what not and i need some help writing my first script...

Id like to make a script that when opened clicks randomly(in a random location,not random time intervals) within a set of coordinates.(2 times,as in 2 random loactions within the set of coordinates). Then clicks once at one specific coordinate. Loops those 3 clicks(the 2 random and the one specific) And exits only when i press and hold the ESC key.

Any help would be very much appreciated.

If you need to know what im making this for(many fourms do) its just for some computer automation experimentation within a set of programs... to make my life easier.

Share this post


Link to post
Share on other sites



EuphoricApathy,

Welcome to the AutoIt forum. :)

I suggest you look at Mouseclick, Random, HotKeySet & While...WEnd in the Help file as those functions will give you the basic requirements to code what you require - come back if you have problems putting it all together. ;)

But there are better ways of automating software for testing which are not reliant on coordinates (and hence screen resolution) - with more information we might be able to suggest another route for you to take. Can you give us some details (or even a screenshot) of the apps which you are trying to automate? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

EuphoricApathy,

Welcome to the AutoIt forum. :)

I suggest you look at Mouseclick, Random, HotKeySet & While...WEnd in the Help file as those functions will give you the basic requirements to code what you require - come back if you have problems putting it all together. ;)

But there are better ways of automating software for testing which are not reliant on coordinates (and hence screen resolution) - with more information we might be able to suggest another route for you to take. Can you give us some details (or even a screenshot) of the apps which you are trying to automate? :huh:

M23

Got what i was looking for with this:

func exitthescript()
   Exit
EndFunc

HotKeySet( "{ESC}", "exitthescript" )

while 1
   $posx = Random(197, 610)
   $posy = Random(210, 623)

   MouseClick("left", $posx, $posy )
   MouseClick("left", $posx, $posy )
   MouseClick("left",345,693,1)

   WEnd

But its way too slow,anyway i can remove the mouse moves its making entirely? thx

EDIT: Actually this isnt exactly working correctly,its just going back and forth between a random click and my fixed coordinate click,its not making 2 random clicks...

Edited by EuphoricApathy

Share this post


Link to post
Share on other sites

EuphoricApathy,

 

its way too slow

Really? The default delay between clicks is 10ms - what sort of testing requires faster clicking than that? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

fixed the not doing 2 random clicks issue with this,lucky guess i guess :

func exitthescript()
   Exit
EndFunc

HotKeySet( "{ESC}", "exitthescript" )

while 1
   $posx = Random(197, 610)
   $posy = Random(210, 623)
   $posx2 = Random(197, 610)
   $posy2 = Random(210, 623)

   MouseClick("left", $posx, $posy )
   MouseClick("left", $posx2, $posy2 )

   MouseClick("left",345,693,1)

   WEnd

But yeah its too slow,10ms doesnt sound right at all,as the mouse takes time to move from point to point.

i want it like this:

1. click point a

2.click point b

3.click point c

with no mouse movement whatsoever.

Edited by EuphoricApathy

Share this post


Link to post
Share on other sites

EuphoricApathy,

Look at the parameter list for Mousclick - the final one should be what you want. ;)

And you seem strangely reluctant to answer any of my questions - could there be any particular reason why? :whistle:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I figured it out thankyou very much for your help!!!

To answer your questions and if you must know what im doing,im running this with an on screen keyboard to generate random combinations of letters. I wanted it to go as fast as possible simply for efficiency.

THX AGAIN!!

Edited by EuphoricApathy

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