Jump to content
Macro Express Forums

how to move mouse cursor in a specific textbox in a dialog box?


Recommended Posts

hi

 

Please help me, how to move mouse cursor in a specific textbox in a active dialog box directly?

note: Without Being aware of text box position, just with aware of name of the textbox.

for example when "Create Output ..." windows is shown, mouse cursor insert in "Name" textbox, with aware of name of the textbox ("Name").

 

tnx very much

saleh safarian

 

 

dialog box.png

Link to comment
Share on other sites

I agree with Cory. See if you you reliably reach the field by tabbing. Or check if Macro Express can recognize any of the fields or screen areas as controls.

 

You may be able to reset the tab order by clicking somewhere in the left margin (where the labels appear), or in the grey stripe that begins with the word "Specify..."

Link to comment
Share on other sites

What happens if you do use the mouse commands? In some applications I find that's the only reliable way to get the job done.

 

For example,

Mouse Move: 123, 456 Relative to Current Window
Mouse Left Click // Click at end of Name box
Text Type (Simulate Keystrokes): <SHIFT><HOME> // Select existing text
etc

 

Link to comment
Share on other sites

The method Terry suggests can work nicely, and it's so simple. But when clicking at (x, y) fails, all hell might break lose!

 

I do major back flips to avoid clicking at (x, y) when scripting macros. Instead of clicking on a coordinate, I might hunt for a pixel colour (and then click), monitor the shape of the mouse cursor (and then click), search for and give focus to text that is at, or near, my target (and then tab to it), or use controls to directly interact with my target. Or a combination of all the above. So rather than clicking blindly on a coordinate, these methods use a modicum of intelligence built into the macro to zero in on a target.


When these more complex, less intuitive, math-driven methods fails, it's not pretty either. But at least it's satisfying to develop scripts that function reliably under many conditions.

Link to comment
Share on other sites

On 8/23/2019 at 11:10 PM, Cory said:

You should be using MEP control commands if it's a Win32 (WinForm) application. If you are in a web page, it's very difficult. You're better off tabbing around. 

yes it's a Win32 (WinForm) application.

but don't want use tabbing...

tanx

Link to comment
Share on other sites

On 8/24/2019 at 2:28 AM, terrypin said:

What happens if you do use the mouse commands? In some applications I find that's the only reliable way to get the job done.

 

For example,


Mouse Move: 123, 456 Relative to Current Window
Mouse Left Click // Click at end of Name box
Text Type (Simulate Keystrokes): <SHIFT><HOME> // Select existing text
etc

 

 

On 8/24/2019 at 1:25 AM, acantor said:

I agree with Cory. See if you you reliably reach the field by tabbing. Or check if Macro Express can recognize any of the fields or screen areas as controls.

 

You may be able to reset the tab order by clicking somewhere in the left margin (where the labels appear), or in the grey stripe that begins with the word "Specify..."

No I can't reliably reach field by tabbing or mouse move. i just know the name of textbox

Link to comment
Share on other sites

On 8/24/2019 at 2:28 AM, terrypin said:

What happens if you do use the mouse commands? In some applications I find that's the only reliable way to get the job done.

 

For example,


Mouse Move: 123, 456 Relative to Current Window
Mouse Left Click // Click at end of Name box
Text Type (Simulate Keystrokes): <SHIFT><HOME> // Select existing text
etc

 

i just know the name of textbox, so I can't use "move mouse" command or tabbing

Link to comment
Share on other sites

On 8/24/2019 at 6:13 AM, acantor said:

The method Terry suggests can work nicely, and it's so simple. But when clicking at (x, y) fails, all hell might break lose!

 

I do major back flips to avoid clicking at (x, y) when scripting macros. Instead of clicking on a coordinate, I might hunt for a pixel colour (and then click), monitor the shape of the mouse cursor (and then click), search for and give focus to text that is at, or near, my target (and then tab to it), or use controls to directly interact with my target. Or a combination of all the above. So rather than clicking blindly on a coordinate, these methods use a modicum of intelligence built into the macro to zero in on a target.


When these more complex, less intuitive, math-driven methods fails, it's not pretty either. But at least it's satisfying to develop scripts that function reliably under many conditions.

i just know the name of textbox, and I don't know coordinate of textbox, so I can't use "move mouse" command or tabbing

Link to comment
Share on other sites

On 8/27/2019 at 12:20 AM, terrypin said:

That's what the Mouse Locator tool is for.

 

I recommend you read the excellent Help offered in the program.

 

 

MouseLocator.jpg

 

I know this tools !!!

but:
1-dialog and place of textbox change constantly
2-my macro execute in different PC with different Screen Resolution
so I cant use tabbing or mouse move command...!
 
MEP recognizes the name of 'open windows' well, but MEP can't recognizes textbox ???!!!
 
Tnx very much
Link to comment
Share on other sites

Did you  explore the earlier suggestions such as using Controls or pixel recognition? What tests have you done with those?

 

We really need to see an actual example we can try. A web page or a free program download link. Or alternatively, a few much higher resolution screenshots.

 

As I understand it, what you do have to work with is a known dialog containing named text boxes. Just the one you showed, or are there others? What does the entire screen look like at the time you want to activate your macro, and exactly what do you want it to do?

 

I assume the text boxes into which you want to click are always all in the same relative positions, although actual screen pixel locations will vary for the reasons you gave. So as @acantor suggested, clever/complex use of pixel identification might work.

 

Another approach might be OCR followed by string tests. It would need a third party OCR tool and extra  logic in your macro to ensure reliability.

 

One other long shot. Open a typical screen containing the text boxes and then run a macro which includes at minimum a Window Activate command or similar. Does MEP include the dialog as a window in its list (Visible or Hidden)? Unlikely, but if so you could use the Variable Set Integer options to establish its location and dimensions, and therefore where to click a specific text box.

 

The devil is in the details!

ClickTextBox-1.jpg

Link to comment
Share on other sites

  • 2 months later...

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