EuphoricApathy Posted April 22, 2014 Share Posted April 22, 2014 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2014 Moderators Share Posted April 22, 2014 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? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
EuphoricApathy Posted April 22, 2014 Author Share Posted April 22, 2014 (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? 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 April 22, 2014 by EuphoricApathy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2014 Moderators Share Posted April 22, 2014 EuphoricApathy, its way too slowReally? The default delay between clicks is 10ms - what sort of testing requires faster clicking than that? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
EuphoricApathy Posted April 22, 2014 Author Share Posted April 22, 2014 (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 April 22, 2014 by EuphoricApathy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2014 Moderators Share Posted April 22, 2014 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? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
EuphoricApathy Posted April 22, 2014 Author Share Posted April 22, 2014 (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 April 22, 2014 by EuphoricApathy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now