Move mouse (To image) with animation

Ideas for new features & functions

Moderators: JRL, Dorian (MJT support)

Post Reply
Asentrix
Newbie
Posts: 2
Joined: Thu Nov 17, 2016 1:51 am

Move mouse (To image) with animation

Post by Asentrix » Wed Nov 23, 2016 5:58 pm

I want to buy macro scheduler , but the lack of this feature is holding back my purchase.
I want the same feature to be implemented that winautomation offers:

• Moving the mouse to an image with animation , instead of instant movements
- Optional speed calibration would be nice , eg moveMouseAnim.1-10 , to define the speed

• Moving mouse to a pixel / point on the screen with animation

Marcus provided me with this code , but I see it as a work around , not a solution
I am thankful for the support btw Marcus

Code: Select all

Let>y=550
Repeat>y
  MouseMove>850,y
  Let>y=y-5
  Wait>0.02
Until>y=150
Thanks!

User avatar
Grovkillen
Automation Wizard
Posts: 406
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Re: Move mouse (To image) with animation

Post by Grovkillen » Wed Nov 23, 2016 6:24 pm

I hear this being a suggestion but I find Marcus' solution showing of a superb feature of MS:

Even if there's no specific command to do something it is almost 100% possible to do it in other ways. Other automation software I have used is pretty limited in this area. You are left to what the developers intended the software to do. So I wouldn't think twice when it comes to pay the license fee (which by the way is most reasonable I think) for MS.

That being said, I find your enhancement suggestion a solid one (I have made such suggestions myself because I sometimes find it better to have a native command available than having to invent the wheel again and again. Marcus often implement suggestions like this if it is of gain to many users.)

Over and out! :)
Let>ME=%Script%

Running: MS14.5.4

Asentrix
Newbie
Posts: 2
Joined: Thu Nov 17, 2016 1:51 am

Re: Move mouse (To image) with animation

Post by Asentrix » Wed Nov 23, 2016 7:19 pm

Yep Marcus's suggestion was handy , but it doesn't solve my situation
That code is good for moving the mouse to specific points on the screen , but because I need specific images clicked within a dynamic application (moving elements in a game) , moving the mouse to specific spots wouldn't work

The images move across the screen and change position , so it wouldn't work , if that makes sense.
Thanks for the input!

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: Move mouse (To image) with animation

Post by Jerry Thomas » Wed Nov 23, 2016 8:53 pm

Marcus' approach will work you just have to convert the absolute values to variables based on the window location.

You can change this to move to the middle of the window, or 10pts off the top left corner or whatever you need.

Target Position can be checked and updated during the loop.

Code: Select all

// Set the current cursor position
GetCursorPos>CurXpos,CurYpos,csType
// Set target position
GetWindowPos>Untitled - Notepad,TargetXpos,TargetYpos

// While either cursor axis is not in the correct location...
While>{(%CurXpos%<>%TargetXpos%) and (%CurYpos%<>%TargetYpos%)}
  // If X axis distance between current and target is greater than 5 then move
  // Negative move
  If>{(%CurXpos%-%TargetXpos%)>5}
    Let>CurXpos=CurXpos-5
  else
    // Positive move
    If>{(%CurXpos%-%TargetXpos%)<-5}
      Let>CurXpos=CurXpos+5
    else
      // Distance is less then 5, move cursor to desired position
      Let>CurXpos=TargetXpos
    endif
  endif

  // If Y axis distance between current and target is greater than 5 then move
  // Negative move
  If>{(%CurYpos%-%TargetYpos%)>5}
    Let>CurYpos=CurYpos-5
  else
    // Positive move
    If>{(%CurYpos%-%TargetYpos%)<-5}
      Let>CurYpos=CurYpos+5
    else
      // Distance is less then 5, move cursor to desired position
      Let>CurYpos=TargetYpos
    endif
  endif

  MouseMove>CurXpos,CurYpos
EndWhile
Thanks,
Jerry

Jerry.Thomas@OMAX.com

User avatar
CyberCitizen
Automation Wizard
Posts: 720
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Move mouse (To image) with animation

Post by CyberCitizen » Fri Dec 09, 2016 5:36 am

Macro Scheduler isn't really a game bot, but a very powerful automation tool.

I don't see why mouse moving to a spot is required, it just needs to click in certain locations, you could also use image recognition to work out where you need to click etc.
FIREFIGHTER

Post Reply