briang123 Posted June 25, 2018 Share Posted June 25, 2018 I'm trying to create an array that contains 4 MouseClick destinations so that I can continuously cycle through clicking these 4 worlds with a while loop. I'm used to working in Python and not in AutoIt so declaring variables with MouseClick is messing me up. I thought I could define the variables in $WorldList without clicking those destinations until I call them with $WorldList[$Counter] where the $Counter variable is my iterator. Ideally I would be able to define the array, $WorldList, without clicking anything -> sleep for 1 second -> click 627,501 -> sleep for 1 second -> define variable $Counter = 0 -> click the destinations in an infinite loop in order from [0] to [3] from the $WorldList When I run my code I end up clicking the 4 destinations in $WorldList (which I don't want to happen) -> delay 1 second -> click 627,501 -> delay 1 second -> then my program doesn't click anything anymore Any help would be greatly appreciated! Thanks. Local $WorldList[4] $WorldList[0]= MouseClick("left", 775, 67, 1, 3) $WorldList[1]= MouseClick("left", 776, 332, 1, 3) $WorldList[2]= MouseClick("left", 775, 357, 1, 3) $WorldList[3]= MouseClick("left", 778, 380, 1, 3) sleep(1000) MouseClick("left", 627, 501, 1, 3) sleep(1000) Local $Counter = 0 while(1) $WorldList[$Counter] $Counter += 1 ;if statement used to reset '$WorldList' from the last world to the first world on the list if $Counter = 4 Then $Counter = 0 EndIf WEnd Link to comment Share on other sites More sharing options...
careca Posted June 25, 2018 Share Posted June 25, 2018 (edited) Local $WorldList[4][2] $WorldList[0][0]= 775 $WorldList[0][1]= 67 $WorldList[1][0]= 776 $WorldList[1][1]= 332 $WorldList[2][0]= 775 $WorldList[2][1]= 357 $WorldList[3][0]= 778 $WorldList[3][1]= 380 MouseClick("left", 627, 501, 1, 3) sleep(1000) For $c = 0 To 3 sleep(1000) MouseClick("left", $WorldList[$c][0], $WorldList[$c][1], 1, 3) ;If $c = 3 Then $c = 0 ;Uncomment to loop Next Maybe like this? Edited June 25, 2018 by careca briang123 1 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 Link to comment Share on other sites More sharing options...
briang123 Posted June 25, 2018 Author Share Posted June 25, 2018 For $c = 0 To 4 If $c = 4 Then $c = 0 EndIf LC(627,501) ;Shortcut User-made Function for MouseClick sleep(1000) MouseClick("left", $WorldList[$c][0], $WorldList[$c][1], 1, 3) Next Thank you so much careca! I don't know why I couldn't think to use multi-dimensional arrays and to iterate the x,y coordinates in MouseClick. You're a lifesaver! The For loop wasn't working but I found the fix by moving the if statement to the top and making the for loop go to 4 instead of 3. Link to comment Share on other sites More sharing options...
careca Posted June 25, 2018 Share Posted June 25, 2018 Glad you could use it and make it work. 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 Link to comment Share on other sites More sharing options...
abdulrahmanok Posted March 7, 2022 Share Posted March 7, 2022 I know this is very old thread but I hope this help someone in future : Dim $x[3] = ["1336, 325", "1464, 344"] For $i = 0 to UBound($x) -1 $split = StringSplit($x[$i], ',') ; _ArrayDisplay($split) MouseMove($split[1],$split[2] ) Next 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