Jump to content
Macro Express Forums

Moving mouse to window of running program


Recommended Posts

Is it possible to write a macro which selects the window of a running program and moves the mouse to a position relative to that window? One would need to set the mouse locator to show the position relative to that window, so as to know how to set "mouse move". Of course while writing the macro the currently-running program is Macro Express Pro, not the program of interest. The mouse locator does not then show the mouse position relative to the program of interest. Is it possible to make it do so while writing the macro?

Link to comment
Share on other sites

Something like this? Use the "Mouse Locator" to identify the x y position in the target window.If I understand correctly, you want to position the mouse relative to a different window than the one that is currently focused.

Variable Set String %CurrentWindow% to topmost window title
//
Window Activate: - Target Window
Delay: 500 milliseconds // A delay may or may not be needed
//
Mouse Move: 123, 456 Relative to Current Window
//
// Do what you need to do in the target window
//
Window Activate: %CurrentWindow%

Link to comment
Share on other sites

It's pretty simple. You start the command and select the option to be relative to the window, launch the locator, change focus to the window, position your mouse, and type CTRL+Space. I think people often forget to read the short instruction in the command and fail to change the method to be relative to the window instead of relative to the screen.

Link to comment
Share on other sites

The condition that must be met is that the window title you specify matches, in whole or in part, the title of the window you want brought to the fore.

 

Hint: the window title is often in this format:

 

XXXX - YYYY

 

E.g.,

 

Macro Express Pro - Explorer

Document1 - Microsoft Word

Moving mouse to window of running program - Macro Express Pro - Macro Express Forums - Mozilla Firefox

 

Note the pattern at the end of each line is space hyphen space ProgramName

 

So if you specify a partial match, do this: For Macro Express's Explorer:

- Explorer

 

For Microsoft Word documents:

- Microsoft Word

 

For Firefox:

- Mozilla Firefox

 

Check out the Help screen for Window Activate. Macro Express help screens are excellent... much better than most applications.

Link to comment
Share on other sites

I found that 'mouse move' would not work. What did make it work was to select tkinter's console window. Although I have no command to select or deselect any window, "mouse move" seems to work only when this particular window is selected. The macro is: Mouse Move: 165, 67 Relative to Screen. Delay: 0.5 seconds. Mouse Left Click. Delay: 1 seconds. Nothing else. Activation is Ctrl+Alt+W. Scope is global. I closed the tk program to see what that did, but Mouse Move did not work. There was a momentary appearance of the circular blue progress icon. The macro behaves as if its scope is within tk. I have no time now but perhaps rebooting Windows will make it work. I suppose that is the next thing to try, but it would not solve how to make a useful macro.

 

Regards

 

John Sampson

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...
 Share

×
×
  • Create New...