CyWave Posted February 10, 2013 Share Posted February 10, 2013 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 More sharing options...
Bert Posted February 10, 2013 Share Posted February 10, 2013 Look at getting the mouse coordinates from the client window. Look at AutoItSetOption > MouseCoordMode The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
water Posted February 10, 2013 Share Posted February 10, 2013 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
CyWave Posted February 10, 2013 Author Share Posted February 10, 2013 (edited) 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 February 10, 2013 by CyWave Link to comment Share on other sites More sharing options...
Bert Posted February 10, 2013 Share Posted February 10, 2013 What is the application you are working with? We may have a better solution. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted February 10, 2013 Share Posted February 10, 2013 Remove this Sleep(50) _GoToBlack() from your function body for a start. And do try a little better than "that don't work, like I want" as an explanation of your problem. 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 More sharing options...
CyWave Posted February 10, 2013 Author Share Posted February 10, 2013 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 More sharing options...
water Posted February 10, 2013 Share Posted February 10, 2013 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Bert Posted February 10, 2013 Share Posted February 10, 2013 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.... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted February 10, 2013 Share Posted February 10, 2013 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 More sharing options...
water Posted February 10, 2013 Share Posted February 10, 2013 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
CyWave Posted February 10, 2013 Author Share Posted February 10, 2013 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 More sharing options...
JohnOne Posted February 10, 2013 Share Posted February 10, 2013 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 More sharing options...
Bert Posted February 11, 2013 Share Posted February 11, 2013 I think I know what he has in mind. Think first person shooter.... Am I right? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
ileandros Posted February 11, 2013 Share Posted February 11, 2013 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 More sharing options...
CyWave Posted February 11, 2013 Author Share Posted February 11, 2013 I think I know what he has in mind. Think first person shooter....Am I right?Yeah, you're right.. I'm sorry I brought this here, but it was my last hope... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2013 Moderators Share Posted February 11, 2013 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. M23 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 Link to comment Share on other sites More sharing options...
Recommended Posts