moving mouse pointer relatively

Ranorex Studio, Spy, Recorder, and Driver.
User avatar
Posts: 5
Joined: Wed Jun 08, 2022 7:55 am

moving mouse pointer relatively

Post by jkischel » Wed Jan 18, 2023 12:22 pm

Hi folks,

I have a recording module with an action "Mouse" -> "Move", as value I entered "50;50" which moves the mouse pointer to absolute screen coordinates x=50, y=50.

Works fine so far. What do I have to enter as value to move the mouse relatively (50 pixels to the left from the current position and 50 pixels to the top from the current position)?
System information:
I'm using Ranorex v9.6.3 on a Windows 10 machine.

Posts: 151
Joined: Thu Aug 11, 2022 8:55 pm

Re: moving mouse pointer relatively

Post by IvanF » Fri Jan 20, 2023 4:47 pm

Hi, for the relative direction overall, you can use options like "UpperLeft", but from what i can see so far, they don't offer easy ways to control the magnitude. You may be able to work around that if you choose repository items for that Move action which you know are at the "right" distance.

User avatar
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: moving mouse pointer relatively

Post by doke » Mon Feb 13, 2023 3:11 pm


if you convert a default mouse move action without item to usrecode , you can easily convert to your need.

I used code below to move mouse pointer to a certain position inside an element(adapter)

public void Mouse_Move_SomeCell(RepoItemInfo cellInfo)
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Move item 'cellInfo' at 304;8.", cellInfo);
Ranorex.Cell mycell = cellInfo.FindAdapter<Cell>();
String mylocation = (mycell.ScreenRectangle.Width -2).ToString()+";"+(mycell.ScreenRectangle.Height-2).ToString();
Report.Log(ReportLevel.Info, "mylocation2", mylocation );
//Mouse.MoveTo(mylocation); // copied from mouse_move , us it to go anywhere on screen