Sign in to follow this  
Followers 0
jannikrendl

MouseMove from current position [amount] of units down

15 posts in this topic

#1 ·  Posted (edited)

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

Edited by jannikrendl

Share this post


Link to post
Share on other sites



#2 ·  Posted

You're asking for help with a dropdown menu, without stating what kind of menu it is, which makes it more than a little difficult to make suggestions. Is it a desktop app or website? Which app/site is it? How about a screenshot of the dropdown menu? The more you give us the more we can give you ;)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@JLogan3o13

This is the dropdown menu. I would like to automate the process of changing the properties by clicking at the file / move the mouse (by myself) to the the file and then simply start the script so it is able to change the file's properties...

Unbenannt.JPG

:)

Edited by jannikrendl

Share this post


Link to post
Share on other sites

#4 ·  Posted

Can you use :

Send("{Down 20}") to move the cursor/selection down 20 times?

put whatever number if lines/menu items in you need instead of the 20.

1 person likes this

Snoopy=====Still trying to shoot down that Red Baron :-))

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@snoopy.pa30

Thanks, it works. But I would like to know how It is done by the mouse so I can use it for other scripts in the future...

 

EDIT: I used @snoopy.pa30 idea but I still need the Mousemovement because I need to tick the read only tickbox.

1.JPG

Edited by jannikrendl

Share this post


Link to post
Share on other sites

#6 ·  Posted

In my (limited) experience with AutoIT, I either use the SEND, or get the actual pixel location of what I have to click on.

I assume you know how to get the pixel location using AutoIT Window Info and Finder Tool.

Sorry I can't suggest anything better.


Snoopy=====Still trying to shoot down that Red Baron :-))

Share this post


Link to post
Share on other sites

#7 ·  Posted

@snoopy.pa30 Yes I know how to find the coordinates :) but it is changing because of the location of the files, etc...

Share this post


Link to post
Share on other sites

#8 ·  Posted

In many windows boxes you can use the TAB key to move between input fields.

So you might be back to the  SEND("{TAB 5}") idea.

1 person likes this

Snoopy=====Still trying to shoot down that Red Baron :-))

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@snoopy.pa30

Yes this will work :)

But I am still wondering how I could do it with the mouse... :)

 

Edited by jannikrendl

Share this post


Link to post
Share on other sites

#10 ·  Posted

Sometimes I like to solve the problem elegantly.

More often I need to solve it quickly.

That is when the BFI methods come in to play.

BFI - Brute Force and Ignorance.

"Git er Done"

1 person likes this

Snoopy=====Still trying to shoot down that Red Baron :-))

Share this post


Link to post
Share on other sites

#11 ·  Posted

@snoopy.pa30

I wasted some time in research so I would like to get a result thats why I still would like to know how to do the process with the mouse... :)

 

Share this post


Link to post
Share on other sites

#14 ·  Posted

google broken?

not sure if you have to deal with twips 

func example()
    _mousemove(10,10)
EndFunc

Func _MouseMove ($iX, $iY)
    Local $dX = $iX  ;~ $iX*(65535.0/(@DesktopWidth-1))
    Local $dY = $iY  ;~ $iY*(65535.0/(@DesktopHeight-1))
    _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE,$dX, $dY)
;~     DllCall ("user32.dll", "int", "mouse_event", "int", $MOUSEEVENTF_MOVE, "int", $dX, "int", $dY, "int", 0, "int", 0)
EndFunc

 

Share this post


Link to post
Share on other sites

#15 ·  Posted

@junkew

NVM I used the suggested way by @snoopy.pa30. 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
Sign in to follow this  
Followers 0

  • Similar Content

    • Mr_Was_geht_sie_das_an
      By Mr_Was_geht_sie_das_an
      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 ?
       
       
       
    • Tarakesh
      By Tarakesh
      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
    • RichardL
      By RichardL
      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.
    • azcn2503
      By azcn2503
      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?
    • ludocus
      By ludocus
      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