Jump to content

Search the Community

Showing results for tags 'mousemove'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 12 results

  1. Hello. Is it possible to set the mouse move speed to a value between 1 and 2? MouseMove(x, y, 1) is too quick but MouseMove(x, y, 2) is a bit too slow. Context: My son is playing a single player fishing game and he asked me for help. The faster the mouse cursor moves when casting his "fishing line", the further the fishing line goes. When MouseMove(x, y, 2) is used, my son is able to move his cursor faster than autoit can. When MouseMove(x, y, 1) is used, the mouse cursor moves too quickly, and the game does not register the mouse move action. I would like to find that "sweet spot" where the mouse moves as quickly as possible, but slow enough to where the game can register that speed. I'd love to introduce my son to the power of scripting/programming to further peak his interest in it. Video games can act as a fun platform to do just that.
  2. This one has me baffled. I can't seem to get MouseMove to work properly with scaling in some windows. Run this program and use the arrow keys to move the mouse Up, Down, Left, Right at native (100%) scaling and it works as expected. Now go to 125%, for example, and move Up, Down, Left, Right on the desktop and it works. Now open the MouseMove help window (cursor on MouseMove then F1). Move the mouse into the MouseMove help window and try Up, Down, Left, Right and the movements are diagonal! If you move, for example, right from desktop into the MouseMove window it goes from moving right to down and right (diagonal) as soon as the mouse hits the MouseMove help window. I'm stumped. How do I get MouseMove to work properly? Any hints appreciated. ; ;#AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK ;Trying to figure out how to scale properly for MouseMove - moving mouse in Up, Down, Left, Right moves diagonally on some windows if scale <> 1 (100%). ;Test on main monitor and use 1920x1080 then scale to 125% as simple example. ;To change display scale in Windows 10, right click on desktop "Display Settings" --> Scale and layout ;arrow keys on arrow keypad HotKeySet("{UP}", "__UpMouse") HotKeySet("{DOWN}", "__DownMouse") HotKeySet("{LEFT}", "__LeftMouse") HotKeySet("{RIGHT}", "__RightMouse") ;v2g - cutting out superfluous code to show issue, added scaling Opt("MouseCoordMode",1) ;1 = absolute screen coordinates (default) - use this because otherwise active window mucks it up $scale = _GetScale() MsgBox(0,"DEBUG", "$scale = " & $scale) While 1 ;watch the console - the mouse is not moving correctly Sleep(10) ;this works well and does not appear to use the CPU WEnd ;================= Functions ================== Func __UpMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+0, $mousepos[1]-1) $mouseposafter = MouseGetPos() ConsoleWrite("in __UpMouse()" & @CRLF & "Before UP (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After UP (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __DownMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+0, $mousepos[1]+1) $mouseposafter = MouseGetPos() ConsoleWrite("in __DownMouse()" & @CRLF & "Before DOWN (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After DOWN (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __LeftMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]-1, $mousepos[1]+0) $mouseposafter = MouseGetPos() ConsoleWrite("in __LeftMouse()" & @CRLF & "Before LEFT (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After LEFT (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __RightMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+1, $mousepos[1]+0) $mouseposafter = MouseGetPos() ConsoleWrite("in __RightMouse()" & @CRLF & "Before RIGHT (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After RIGHT (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func _GetScale() ;returns a scale factor for PixelGetColor ;from: https://www.autoitscript.com/forum/topic/156251-mouse-coordinates/?tab=comments#comment-1130002 $tDEVMODE = DllStructCreate('byte[32];dword[10];byte[32];dword[6]') $pDEVMODE = DllStructGetPtr($tDEVMODE) $i = 0 while 1 $ret = DllCall('user32.dll', 'int', 'EnumDisplaySettings', 'ptr', 0, 'dword', $i, 'ptr', $pDEVMODE) if ($ret[0] = 0) then exitloop $width = DllStructGetData($tDEVMODE, 4, 2) ; native width $i += 1 wend $scale = $width / @DesktopWidth Return($scale) EndFunc
  3. A few days ago I'd written an AutoIt program that drove a Target program to open/modify/save pictures. (Don't want name it, looks like a normal windows application, has a ribbon the little shortcuts appear when you press alt.) Everything working well on a VM (WServer 2012 I think.) Then I moved it to a real computer, Lenovo Think Center Windows 8.1, and the MouseMove stopped working. The MouseMove worked as normal if anything else had the focus (Explorer, Paint, TaskMgr). If Target had the focus the mouse did not move. I tried all 3 values for MouseCoordMode. Tried 32 bit and 64 bit compile. There's a topic somewhere about the mouse not moving, but MouseGetPos says it's moved. I tried that and it showed the mouse had not moved. For a few moments I thought of alternately activating another window to move the mouse, then activate Target, but that was too horrible. We went around the problem by moving to a different computer, Windows Server 2012 again, and everything was fine. 'Target' is the same version in all cases. I've worked with it a few times before, never had any problems. I don't need this solved but I'd be interested to know why.
  4. Can anyone tell me the default parameter to input into, GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "") to disable a previously set user defined function? help file example says empty string ("") which works for other events but doesnt seem to on mouse move. Ive attached some of my test code to select icon by clicking and click on screen where needed to create an icon the same or cancel by right clicking and then escape the window with the keyboard escape key. best solution i have come up with after a few hours of trying different things is to create a DoNothing() function any help would be appreciated. dummy2.au3
  5. So I'm trying to make a script that will move my mouse when I scroll. I know that's weird, but I have my reasons. What I have so far can detect when I'm moving my mouse, but then when I tell the script to make my mouse move whenever it detects scroll activity it freezes. probably because of some feedback loop. Anyway, If anyone on here wants to help, I'm at a loss of how to solve this problem. Like maybe when it is about to take the action of moving the mouse it could stop detection for a bit, idk. but I don't know how to do that. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> #include <GUIConstants.au3> Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Global $currentEvent Global $hDLL = DllOpen("user32.dll") #Region ### START Koda GUI section ### Form= ;Register callback $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr") $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0) #EndRegion ### END Koda GUI section ### While 1 WEnd Func _Mouse_Proc($nCode, $wParam, $lParam) Local $info, $mouseData If $nCode < 0 Then $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _ "int", $nCode, "ptr", $wParam, "ptr", $lParam) Return $ret[0] EndIf $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) $mouseData = DllStructGetData($info, 3) Select Case $wParam = $WM_MOUSEWHEEL If _WinAPI_HiWord($mouseData) > 0 Then ;Wheel Up $currentEvent = "WheelUp" Else ;Wheel Down $currentEvent = "WheelDown" If _IsPressed("02", $hDLL) Then MsgBox(0,"test","test") EndIf EndIf EndSelect ;;;;;;Mouse Movement CAUSES FREEZING, MAKES ME RESTART COMPUTER: if $currentEvent == "WheelUp" then $pos = MouseGetPos() MouseMove($pos[0]+100,$pos[1]+100,0) EndIf $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _ "int", $nCode, "ptr", $wParam, "ptr", $lParam) Return $ret[0] EndFunc ;==>_Mouse_Proc Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0]) $hM_Hook[0] = 0 DllCallbackFree($hKey_Proc) $hKey_Proc = 0 EndFunc ;==>OnAutoItExit
  6. Hello I got this script works below and I want to do not move cursor on screen when action is performed. Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y,0) MouseClick("right", $x, $y)) MouseMove($xMiddle, $yMiddle,0) MouseClick("left", $xMiddle, $yMiddle) EndIf I changed this above to this below and what happen is. It clicks right button and then left button but not move mouse to $x $y and then to $xMiddle $yMiddle. Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then ControlClick("","",0,"secondary",1,$x,$y) ControlClick("","",0,"primary",1,$xMiddle,$yMiddle) EndIf If needed I got handle in var $hwnd Please tell me how parameters in ControlClick would like be
  7. #include<img/img.au3> #include <AutoItConstants.au3> Func Skype() $coords = imageSearch(0,0,-1,-1,"Skype.PNG") MouseMove($coords[0],$coords[1]) [when it find the skype icon i want it to move from these coordinates, but of insted of moving to an expecific coordinate i want it to move down from these coordinates, (there is multiple images so i cant move to an specific image)] -- Kinda having trouble telling what i want cuz english isnt my first language, sorry about that. ;X MouseClick($MOUSE_CLICK_LEFT)
  8. Hey, so I was trying to create a script which clicks an option of a dropdown menu but can't find a solution to move the mouse from the current position 50 units down... If someone knows how to do this pls help me [EDIT: MBY the solution is to just use MouseGetPos and then use MouseMove(MouseGetPos[0],MouseGetPos[1]+50)? but idk... mby there is a better solution... Global $aPos = MouseGetPos Sleep(10000) MouseMove($aPos[0],$aPos[1]+50,10) ] Edit 2: NOPE Isn't working... Thanks in advance Jannik
  9. Hi, i wanna creat an _Imagesearch / Mousemove script for an 3D/FPS Game and have Problems with the mousemove. In the game like Curveball(2D) its still works but in games like Battlefield (3D) are the absolute coordinates not really helpfull. Someone have an idea or an Example for me ?
  10. Hi, First of all I would like say infinite thanks to the team involved in designing this great tool. Here is my problem 1. Press windows button 2. ESC 3. TAB 4. It will take me to the first pinned icon in the taskbar 5. If I I do SHIFT F10 which usually opens context menu like right click of the mouse. 6. For one of the application I am using it does not support Shift + F10 context menu rather it listens to only mouse right click event. 7. I do a search in a tree view of my application and the search item is selected or focused 8. For eg User1 User2 User3 Now if I search for User1 the tab or focus move to User 1 (Red) User1 User2 User3 If I search for User3 the tab or focus moves to User 3 Now my question is how can I move the mouse automatically go to the focused item on the window. Such that during automation I can issue MoveClick("{RIGHT}") as {SHIFT F10} is not working from the keyboard. It is a java app, unfortunately it is not honoring the right click events from keyboard to open the context WinMinimizeAll(); Send("^{ESC}") Sleep(200) Send("{ESC}") Send("{TAB}") the above scripts take the tab to the first pinned icon in the taskbar. Now i want MouseMove( "move to tab" selection") Regards, Tarakesh
  11. Hi, I am trying to create an automation script that will realistically mimic a users input suitable for recording in a repeatable manner. I am able to use the MouseMove command to hover an icon on the desktop, double click it, and open the software. I searched these forums for a reliable way to use MouseMove to move to a control on the new window and found this article: I have modified the code to look like this so I can see the movement of the mouse: Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = "left", $iClicks = "1", $iSpeed = "30", $iXpos = "", $iYpos = "") $iOriginal = Opt("MouseCoordMode") ;Get the current MouseCoordMode Opt("MouseCoordMode",2) ;Change the MouseCoordMode to relative coords $aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control ConsoleWrite("Control position: " & $aPos[0] & "x" & $aPos[1]) MouseMove($aPos[0] + ($aPos[2]/2) + $iXpos, $aPos[1] + ($aPos[3]/2) + $iYpos, $iSpeed) $mPos = MouseGetPos() ConsoleWrite("Cursor position: " & $mPos[0] & "x" & $mPos[1]) MouseClick($iButton, Default, Default, $iClicks, $iSpeed) ;Move the mouse and click on the given control Opt("MouseCoordMode",$iOriginal) ;Change the MouseCoordMode back to the original EndFunc ;==>_ControlMouseClick Now, when I try to call this function using the following code: _ControlMouseClick($installerTitle, "", "[CLASS:Button; INSTANCE:2]") I get the following written to the console: And the mouse has not visibly moved across the screen at all. It is still hovering the icon on the desktop. Here is the full code I have: ; #FUNCTION# ==================================================================================================================== ; Name...........: _ControlMouseClick ; Description ...: Use the mouse to move to a control and click it ; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = "left" [, $iClicks = "1" [, $iSpeed = "10" [, $iXpos = "" [, $iYpos = "" ]]]]] ) ; Parameters ....: $iTitle - The title of the window containing the control ; $iText - Some text from the window containing the control. Can enter no text be using "" ; $iControl - The Control ID of the control to click ; $iButton - [optional] The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary". Default is "left" ; $iClicks - [optional] The number of times to click the mouse. Default is 1. ; $iSpeed - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10. ; $iXpos - [optional] The x position to click within the control. Default is center. ; $iYpos - [optional] The y position to click within the control. Default is center. ; Author ........: Kris Mills <fett8802 at gmail dot com> ; UserCallTip....: _ControlMouseClick ( "title", "text", controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include <KrisUDF.au3>) ; =============================================================================================================================== Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = "left", $iClicks = "1", $iSpeed = "30", $iXpos = "", $iYpos = "") $iOriginal = Opt("MouseCoordMode") ;Get the current MouseCoordMode Opt("MouseCoordMode",2) ;Change the MouseCoordMode to relative coords $aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control ConsoleWrite("Control position: " & $aPos[0] & "x" & $aPos[1]) MouseMove($aPos[0] + ($aPos[2]/2) + $iXpos, $aPos[1] + ($aPos[3]/2) + $iYpos, $iSpeed) $mPos = MouseGetPos() ConsoleWrite("Cursor position: " & $mPos[0] & "x" & $mPos[1]) MouseClick($iButton, Default, Default, $iClicks, $iSpeed) ;Move the mouse and click on the given control Opt("MouseCoordMode",$iOriginal) ;Change the MouseCoordMode back to the original EndFunc ;==>_ControlMouseClick MouseMove(110, 110, 30) MouseClick("", Default, Default, 2) $installerTitle = "Setup" WinWait($installerTitle) WinActivate($installerTitle) _ControlMouseClick($installerTitle, "", "[CLASS:Button; INSTANCE:2]") Any thoughts on getting this to work so that the cursor moves smoothly over the control I am specifying?
  12. Dear all, I'm creating this program where the goal is to automate some mouse -click and dragging on an external application. Now the problem is, this external application is blocking every automate mouse moves, clicks or anything related to using the mouse. So I figured autoit uses postmessage and user32.dll to move the mouse and that this application blocks these attempts. Now I'm wondering if there's a different way to move the mouse so it'll go undetected by this external app. Any other suggestions are welcome to. Thnx in advance
×
×
  • Create New...