Jump to content

MouseMove(+x/+y)


CyWave
 Share

Recommended Posts

Hey, I'm writing a project, witch should do some stuff for me, my problem is to move the mouse:

$pos=MouseGetPos()
MouseMove($pos[0]+x, $pos[1]+y, 0)
;Move mouse right x and down y

So my problem is, that i also want to move the mouse, if it is always central positioned, so if i do it like the code above

it tries to get to the position tries and tries, and moves to much(more then x/y). So I just want to move the mouse (+x/+y) If you know what I mean...

Link to comment
Share on other sites

You need to provide a full reproducer script which we can use for testing. The code above doesn't work becausee x and y need to be variables.

Which program do you try to automate?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

AutoItSetOption ( "MouseCoordMode" , 2)

While 1
_GoToBlack()
Sleep (50)
WEnd
Func _GoToBlack()
$pos = MouseGetPos()
$coord= PixelSearch ($pos[0]-300, $pos[1]-300, $pos[0]+300, $pos[1]+300, 0x000000)
If NOT @error Then
Mousemove ($coord[0],$coord[1])
;MsgBox ( 0, "Point at:", $coord[0]&"<-x || y->"&$coord[1] )
Sleep(50)
_GoToBlack()
Else
Sleep(50)
EndIf
EndFunc

Again it tries to get to a position, witch isn't possible, because the mouse is central positioned, and can't move there, it just should move (x/y) and not to (x/y) so it's like if you want to go to a position, witch is one step away and walking this one step..

Edited by CyWave
Link to comment
Share on other sites

The application is just a little test, it's more about a solution, for moving the mouse without coordinates. So move it for example x to the right, without knowing your actual coordinates.

I'm not sure if there is a solution for that, that's also why I'm here, to ask people with great AutoIt skills.

Link to comment
Share on other sites

Why do you want to solve a "problem" that isn't a real problem? Why put time into something that isn't of any use?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The application is just a little test, it's more about a solution, for moving the mouse without coordinates. So move it for example x to the right, without knowing your actual coordinates.

I'm not sure if there is a solution for that, that's also why I'm here, to ask people with great AutoIt skills.

but there is nothing wrong with your code apart from the recursion.

you say it's not working, well whats not working about it?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Something tells me the OP is being vague on purpose. Water, I will bet you and I are thinking the same thing. Lets not waste our time further. Moving on....

How do you know what I think ;)

But you are correct, it's better to move on. Now it's time for a good Whisky and a good book.

"See" you tomorrow.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The problem is, that I want to move the mouse even if the mouse is central at my monitor, and can't be moved, it just changes the background. So I just want to move the mouse like normal, but with the mouse staying in center, but when I try it with this program, he always tries to move the mouse to the specific coordinate(witch he can't reach). So he's changing the background to much.

Link to comment
Share on other sites

I'd like to help but frankly none of what you are saying makes any sense to me.

maybe one thing only does, your mouse will try to move somewhere it cannot go because if it's at sat x10 and y10 then -300 for both are off the screen. it might also return black at those coordinates.

Anyway, I'm out, I just don't understand your gibberish sorry.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

See the Remarks of the pixelsearch function in the help files and you will understand why it does what it does.

The search direction varies as follows:
Left-to-Right - left < right
Right-to-Left - right < left
Top-to-Bottom - top < bottom
Bottom-to-Top - bottom < top
Changing the search direction can be a useful optimization if the color being searched for frequently appears in in a specific quandrat of the search area since less searching is done if the search starts in the most common quadrant.

Remember, a typical display at 1024 x 768 has 786432 pixels. Although PixelSearch is optimized, narrowing the search area helps speed up the result.

I feel nothing.It feels great.

Link to comment
Share on other sites

  • Moderators

CyWave,,

Please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...