Jump to content
Macro Express Forums

Move cursor relative to the active window


Recommended Posts

The only way I know to move it is to specific x- and y-coordinates. If you need to adjust for multiple users who format their menus and tool bars differently, then maybe you can find some attribute on the screen that give you an adjustment factor. For example, I have macros for a web-based application used by dozens of PCs, and the initial window has a blue band across the top about 80 pixels from top to bottom. So I scan downward from the top of the screen looking for that color, make sure the next 80 pixels downward are the same color, and record the y-coordinate where the first blue pixel was found. After that, all mouse movements are window-relative plus or minus the band factor.

Link to comment
Share on other sites

I was hoping to avoid pixel sniffing to do this! There are too many ways that my users set up their systems.

 

I am scripting for a web app running in IE, and recently discovered that some users display the History pane, which means that I can't be hunting for pixels on the left side of the screen.

 

The solution I may use is to hunt for ten consecutive pixels of the predominant background colour in the lower right corner of the screen.

 

I think I am going to put in a feature request...

Link to comment
Share on other sites

I think I am going to put in a feature request...

But what is the feature you're requesting? If it's to find 10 consecutive pixels of a specified colour, you can already do that with the commands provided by constructing a simple Repeat loop. Surely new features are to be requested only if there's something you cannot already do in MEP? Or something that takes a lot of code to achieve.

Link to comment
Share on other sites

 

The solution I may use is to hunt for ten consecutive pixels of the predominant background colour in the lower right corner of the screen.

 

You might also be able to incorporate the <Ctl+Sh+h> toggle to momentarily switch off the History pane.

 

I think I am going to put in a feature request...

 

Re Paul's point, my trusty Stiletto power utility appears to display relative positions within panes, so there might well be scope for a new feature in ME Pro.

 

In this example, note that the screen positions (located at the bottom right corner of the yellow Stiletto pop-up) are identical, but the window-relative positions are

Stiletto: 122,354

ME Pro: 396, 497

 

FWIW, I've frequently had problems when using the window-relative option on complex windows with several types of pane. It seems that 'relative to window' does not always mean 'relative to the top left corner of the currently active main window' in ME Pro.

 

MousePositionAlan-1.jpg

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I've made a feature request. One of the scripting tools that I use (NaturallySpeaking Advanced Scripting) has a command to position the mouse cursor relative to the active window. It's convenient to NOT have to kludge something together every time!

 

Anybody know of a programmatic way to determine whether the History pane is on or off? I tried several approaches based on pixel colour or mouse cursor detection, but these techniques are not reliable enough. What would be ideal is a way to do this programmatically. Where does IE store user-specific settings? And can these settings be directly read (and written) by Macro Express?

Link to comment
Share on other sites

Is there a way to move it relative to the part of the window below all menus, toolbars, etc.
Yes, Mouse Move > Relative to Control. At least that works for me.
Link to comment
Share on other sites

Yes, Mouse Move > Relative to Control. At least that works for me.

 

Hi Cory,

 

This can work, and in fact, I tried the approach yesterday. But it fails when the active window does not have focus. If the user has inadvertently shifted keyboard input focus to a menu or "ribbon" -- which I observe often, especially when a user inadvertently presses Alt or is clicking around the screen -- the command does not work.

Link to comment
Share on other sites

But if you focus it immediately before the click it should work.

 

Sounds intriguing. Now sure I know how to do this.

 

Let's say I have any old IE window open. I want to click in the upper left hand corner of the active window, say at (1,1). When I invoke the command, focus may be within the active window, in the Search box, on the menu bar, or in the History pane.

 

How can I put focus in the active window, without clicking -- because I don't want to inadvertently click a link, button, etc. -- and without sending a series of Tabs -- because I can't know how users have configured their browsers, with extra toolbars, etc. that throw off the Tab order.

Link to comment
Share on other sites

How can I put focus in the active window, without clicking

Try the Window Activate command. To speed up my macros I check to see if it already has focus:

If Not Window " - Macro Express Forums - Mozilla Firefox" is focused
 Window Activate:  - Macro Express Forums - Mozilla Firefox
End If

Link to comment
Share on other sites

  • 1 year later...

I was doing a google search and a forum search and this thread is exactly what I was looking for. I wish Macro Express Pro would have this option Relative to user defined coordinate. The relative to control have very limited options, like get mouse position does not have relative to control. With relative to user defined coordinate, Macro Express Pro would be a lot more flexible to work with.

Link to comment
Share on other sites

I was doing a google search and a forum search and this thread is exactly what I was looking for. I wish Macro Express Pro would have this option Relative to user defined coordinate. The relative to control have very limited options, like get mouse position does not have relative to control. With relative to user defined coordinate, Macro Express Pro would be a lot more flexible to work with.

 

I see Alan requested it 18 months ago...

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...