Roko Posted May 30, 2020 Posted May 30, 2020 Hi, pretty new to autoit programming and learning.. Here i got a help request for a study project involving the study of randomness on multiple occasions. I need multiple samples, so i thought autoit was the easiest route. What i need is to have the code be able to shuffle click all(related to analysis of distribution of randomness), but without repeats till one loop ends and again for the next loop.. i managed to compose a randomise click within an area, but stuck on how to shuffle the clicks. func exitthescript() Exit EndFunc HotKeySet( "{ESC}", "exitthescript" ) while 1 sleep(10) $posx = Random(930, 1050) $posy = Random(60, 120) $posx2 = Random(930, 1050) $posy2 = Random(120, 180) $posx3 = Random(930, 1050) $posy3 = Random(180, 240) $posx4 = Random(930, 1050) $posy4 = Random(240, 300) $posx5 = Random(930, 1050) $posy5 = Random(300, 360) $posx6 = Random(930, 1050) $posy6 = Random(360, 420) $posx7 = Random(930, 1050) $posy7 = Random(420, 480) $posx8 = Random(930, 1050) $posy8 = Random(480, 540) MouseClick("left", $posx, $posy, 1, 0) MouseClick("left", $posx2, $posy2, 1, 0) MouseClick("left", $posx3, $posy3, 1, 0) MouseClick("left", $posx4, $posy4, 1, 0) MouseClick("left", $posx5, $posy5, 1, 0) MouseClick("left", $posx6, $posy6, 1, 0) MouseClick("left", $posx7, $posy7, 1, 0) MouseClick("left", $posx8, $posy8, 1, 0) WEnd
Moderators Melba23 Posted May 30, 2020 Moderators Posted May 30, 2020 Moved to the appropriate forum. Moderation Team 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
careca Posted May 31, 2020 Posted May 31, 2020 Does this work for you? HotKeySet( "{ESC}", "exitthescript" ) Local $posx1 = 0, $posy1 = 0 For $c = 1 To 8 $posx = Random(930, 1050, 1) $posy = Random(60, 540, 1) If $posx1 <> $posx And $posy1 <> $posy Then ;MouseClick("left", $posx, $posy, 1, 0) ConsoleWrite($posx &' - '& $posy &' - '& @MSEC&@CRLF) $posx1 = $posx $posy1 = $posy EndIf Sleep(100) Next func exitthescript() Exit EndFunc Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Malkey Posted May 31, 2020 Posted May 31, 2020 Here is another example that may help. expandcollapse popup#include <Array.au3> HotKeySet("{ESC}", "Terminate") Local $iInc = 60, $iRandYMin = $iInc, $iRandYMax = $iRandYMin + $iInc Local $aY[9] = [8], $aX[UBound($aY)] = [UBound($aY) - 1] ; Instead of 2 - 1D arrays, could use 1 - 2D array to hold X and Y coordinates. While 1 Sleep(10) $iRandYMin = $iInc $iRandYMax = $iRandYMin + $iInc ConsoleWrite('"Y" Range:-' & @CRLF) For $i = 1 To 8 $aX[$i] = Random(930, 1050, 1) ; Random 8 "X" coordinate values. $aY[$i] = Random($iRandYMin, $iRandYMax, 1) ; Random 8 "Y" coordinate values. ConsoleWrite("Random(" & $iRandYMin & ", " & $iRandYMax & ", 1)" & @CRLF) $iRandYMin = $iRandYMax $iRandYMax = $iRandYMin + $iInc Next _ArrayShuffle($aY, 1) ; Randomize the random "Y" values of each area where the random mouse clicks will be made. ;_ArrayDisplay($aY) ConsoleWrite("MouseClick (X, Y):-" & @CRLF) For $i = 1 To 8 MouseClick("left", $aX[$i], $aY[$i], 1, 0) ConsoleWrite($aX[$i] & ", " & $aY[$i] & @CRLF) Next WEnd Func Terminate() Exit EndFunc ;==>Terminate #cs ; Output example:- "Y" Range:- Random(60, 120, 1) Random(120, 180, 1) Random(180, 240, 1) Random(240, 300, 1) Random(300, 360, 1) Random(360, 420, 1) Random(420, 480, 1) Random(480, 540, 1) MouseClick (X, Y):- 1020, 317 1013, 254 1010, 442 962, 71 963, 505 1005, 416 939, 140 1025, 209 #ce
Roko Posted May 31, 2020 Author Posted May 31, 2020 3 hours ago, careca said: HotKeySet( "{ESC}", "exitthescript" ) Local $posx1 = 0, $posy1 = 0 For $c = 1 To 8 $posx = Random(930, 1050, 1) $posy = Random(60, 540, 1) If $posx1 <> $posx And $posy1 <> $posy Then ;MouseClick("left", $posx, $posy, 1, 0) ConsoleWrite($posx &' - '& $posy &' - '& @MSEC&@CRLF) $posx1 = $posx $posy1 = $posy EndIf Sleep(100) Next func exitthescript() Exit EndFunc Made a little syntax before the mouseclick cmd and added a while wend, this shuffled clicks but repeated them, i could use this too. thankyou. 1 hour ago, Malkey said: #include <Array.au3> HotKeySet("{ESC}", "Terminate") Local $iInc = 60, $iRandYMin = $iInc, $iRandYMax = $iRandYMin + $iInc Local $aY[9] = [8], $aX[UBound($aY)] = [UBound($aY) - 1] ; Instead of 2 - 1D arrays, could use 1 - 2D array to hold X and Y coordinates. While 1 Sleep(10) $iRandYMin = $iInc $iRandYMax = $iRandYMin + $iInc ConsoleWrite('"Y" Range:-' & @CRLF) For $i = 1 To 8 $aX[$i] = Random(930, 1050, 1) ; Random 8 "X" coordinate values. $aY[$i] = Random($iRandYMin, $iRandYMax, 1) ; Random 8 "Y" coordinate values. ConsoleWrite("Random(" & $iRandYMin & ", " & $iRandYMax & ", 1)" & @CRLF) $iRandYMin = $iRandYMax $iRandYMax = $iRandYMin + $iInc Next _ArrayShuffle($aY, 1) ; Randomize the random "Y" values of each area where the random mouse clicks will be made. ;_ArrayDisplay($aY) ConsoleWrite("MouseClick (X, Y):-" & @CRLF) For $i = 1 To 8 MouseClick("left", $aX[$i], $aY[$i], 1, 0) ConsoleWrite($aX[$i] & ", " & $aY[$i] & @CRLF) Next WEnd Func Terminate() Exit EndFunc Worked like a charm exactly what i was expecting..included a sleep timer and checked it too.. Thankyou. Wish i could find a good autoit tutorial, so far ive been catching up on bits and parcels here and there.
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