Sign in to follow this  
Followers 0
augustspies

Custom Mouse Clicks

4 posts in this topic

Hey forum,

does anyone know if it is possible to take for example 5 different sets of mouse clicks

and create some sort of array that when ran it will do 1 set of the mouse clicks -

each time the script is ran?

if so could someone please help with the general layout of how this would be accomplished.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This may not be the most effective way but it gets the job done... You would probably want to switch the If $TimesRun = 4 Then $TimesRun = 0 to a ubound check to make it more dynamic and allow the array to grow or shrink.

#include <Array.au3>
$TimesRun = IniRead(@ScriptDir & "/loadtimes.ini","times","run",1)
local $ClickArray[5][2]

$ClickArray[0][0] = "x"
$ClickArray[0][1] = "y"
$ClickArray[1][0] = 123
$ClickArray[1][1] = 215
$ClickArray[2][0] = 749
$ClickArray[2][1] = 424
$ClickArray[3][0] = 1249
$ClickArray[3][1] = 724
$ClickArray[4][0] = 549
$ClickArray[4][1] = 224

MouseMove($ClickArray[$TimesRun][0],$ClickArray[$TimesRun][1])

If $TimesRun = 4 Then $TimesRun = 0
IniWrite(@ScriptDir & "/loadtimes.ini","times","run",$TimesRun + 1)

edit: I didn't use mouseclick so that it was runnable and you could simply see your mouse move instead....

Edited by Keltset

-K

Share this post


Link to post
Share on other sites

This may not be the most effective way but it gets the job done... You would probably want to switch the If $TimesRun = 4 Then $TimesRun = 0 to a ubound check to make it more dynamic and allow the array to grow or shrink.

#include <Array.au3>
$TimesRun = IniRead(@ScriptDir & "/loadtimes.ini","times","run",1)
local $ClickArray[5][2]

$ClickArray[0][0] = "x"
$ClickArray[0][1] = "y"
$ClickArray[1][0] = 123
$ClickArray[1][1] = 215
$ClickArray[2][0] = 749
$ClickArray[2][1] = 424
$ClickArray[3][0] = 1249
$ClickArray[3][1] = 724
$ClickArray[4][0] = 549
$ClickArray[4][1] = 224

MouseMove($ClickArray[$TimesRun][0],$ClickArray[$TimesRun][1])

If $TimesRun = 4 Then $TimesRun = 0
IniWrite(@ScriptDir & "/loadtimes.ini","times","run",$TimesRun + 1)

edit: I didn't use mouseclick so that it was runnable and you could simply see your mouse move instead....

great thanks for your response, i'll give it a try.

1 follow up question:

the $clickarray - the way you have it setup is that for 1 individual mouse click per array? I was looking to do a group of mouse clicks.

Share this post


Link to post
Share on other sites

Each row consists of a single set of coords for the x and y positions.

$ClickArray[1][0] = 123

$ClickArray[1][1] = 215

$ClickArray[2][0] = 749

$ClickArray[2][1] = 424

row 1 is the coords for one mouse click (x = 123 & y is 215) row 2 is for another set of coords or another mouseclick (x=749 and y=424)

If you need to use a group of clicks simply use more than one row. Alternatively you could have multiple arrays for multiple sets of clicks then loop through the array to activate multiple clicks. You should dig into the help file a bit and play around with arrays to determine what would work best for your situation. If you need your script to choose the correct array to work with initially, you can again store the name of the array you used last into the array to ensure you know what your last operation was and have your script pick a different array on it's start than the previous array it chose.

I would urge you to play around with arrays and become used to working them and with loops. There is a ton of helpful information in the AutoIt help file to get you going with them.


-K

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