yyywww

MouseMove to coordinates

5 posts in this topic

Hello,

I have a sizable amount of coordinates that I want to predefine in my script. Right now they look something like this:

Global Const $button1 = [555, 111] 
Global Const $button2 = [944, 55] 
Global Const $button3 = [850, 550] 
Global Const $button4 = [350, 240] 
 
And so forth.
 
Now I want to use MouseMove() to move the mouse to $button3 for example.
 
Is there an easier way to do this than to use MouseMove($button3[0],$button3[1]) each time? 
 
It would be nicer if I could just use MouseMove($button3) for example.
 
Sorry if this is a silly question, I hope I explained it sufficiently.

Share this post


Link to post
Share on other sites



yyywww,

Welcome to the AutoIt forums. :)

Just write a wrapper function something like this:

Global Const $button1 = [555, 111] 
Global Const $button2 = [944, 55] 
Global Const $button3 = [850, 550] 
Global Const $button4 = [350, 240] 

; Pass the array as a coordinate to a function
_MouseMove($button3)

; And do the hard work in the function
Func _MouseMove($aCoordinates)
    MouseMove($aCoordinates[0], $aCoordinates[1])
EndFunc
That seems to fit the bill. ;)

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

yyywww,

Welcome to the AutoIt forums. :)

Just write a wrapper function something like this:

Global Const $button1 = [555, 111] 
Global Const $button2 = [944, 55] 
Global Const $button3 = [850, 550] 
Global Const $button4 = [350, 240] 

; Pass the array as a coordinate to a function
_MouseMove($button3)

; And do the hard work in the function
Func _MouseMove($aCoordinates)
    MouseMove($aCoordinates[0], $aCoordinates[1])
EndFunc
That seems to fit the bill. ;)

M23

 

Ah, that is smart. That does exactly what I need for my script. I am somewhat new to programming, I wish I could have thought of this myself, haha. Thank you!

Share this post


Link to post
Share on other sites

yyywww,

Glad I could help. :)

But when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. ;)

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

Ok, sorry. WIll do next time. Thanks again.

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