Jump to content
Macro Express Forums

Mouse Move to position seems hit and miss.


Recommended Posts

I have tried this Relative to screen and to current window and don't seem to get reliable results.  I have a macro that positions 2 browsers and a windows notepad on the screen.  Then I run another macro that first goes to the notepad and grabs some data and then activates one of the browsers and then moves the cursor to a test field and them does a left click and them pastes the data.  

 

The problem is that it only works one out of maybe 5 try's.  The Browser windows are exactly the same every time yet the script fails repeatedly.  
Anyone have any tips to improve this accuracy?  As it is this is completely unusable.

 

Thanks in Advance

Link to comment
Share on other sites

It would be helpful to see your second script.

 

My guess is that you need to add delays to give the windows you are interacting with sufficient time to gain focus. If you don't do this, Macro Express might move the mouse pointer to the coordinates for the "wrong" window.

 

If this is the source of the problem, you may be able to avoid it by using Macro Express "Windows/Programs" instructions that activate windows rather than "Mouse" instructions that move the pointer and click.

Link to comment
Share on other sites

Here is the 2nd script

 

<VARIABLE SET INTEGER Option="\x00" Destination="%delay[1]%" Value="300" _COMMENT="Set delays for text inserts"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%delay[2]%" Value="100" _COMMENT="Mouse speed\r\n"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%delay[3]%" Value="50"/>
<MACRO PLAYBACK SPEED Speed="3"/>
<WINDOW ACTIVATE Title="D:\\Users\\theidol\\OneDrive\\Desktop\\sublime\\list1 • - Sublime Text" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<MOUSE SPEED Delay="%delay[2]%"/>
<REPEAT START Start="1" Step="1" Count="10" Save="TRUE" Variable="%cntr%"/>
<TEXT TYPE Action="0" Text="<ARROW DOWN>"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<TEXT TYPE Action="0" Text="<CONTROL><SHIFT>x"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<TEXT TYPE Action="0" Text="<CONTROL>c"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<VARIABLE SET STRING Option="\x02" Destination="%URL[%cntr%]%" NoEmbeddedVars="FALSE"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<END REPEAT/>
<MACRO PLAYBACK SPEED Speed="3"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<WINDOW ACTIVATE Title="Form1 - Google Chrome" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<TEXT TYPE Action="0" Text="<HOME>"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<MOUSE MOVE Option="\x01" X="2106" Y="1383" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="%delay[3]%"/>
<MOUSE LEFT CLICK _COMMENT="Click on text entry field"/>
<TEXT TYPE Action="0" Text="%URL[1]%<TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[2]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[3]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[4]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[5]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[6]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[7]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[8]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[9]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[10]%"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="<TAB><TAB><TAB><TAB><TAB><TAB>" _COMMENT="Move to lower fields"/>
<TEXT TYPE Action="0" Text="%URL[1]%<TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[2]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[3]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[4]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[5]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[6]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[7]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[8]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[9]%<TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="%delay[1]%"/>
<TEXT TYPE Action="0" Text="%URL[10]%"/>

Link to comment
Share on other sites

1 hour ago, TheIdol said:

I have now resorted to using Tabs to select the first field and subsequent ones.  Not Ideal but it works .

 

Tabbing to a field is a good technique in many cases.  If the web page changes you may have to change the number of tabs, which is a pain.  Sometimes you can streamline the process by positioning within the page before tabbing.  For example, the following snippet searches for the text "forgot your password?", then tabs backward a few times to get to the user id field.  Most changes to the web page do not affect this logic. 

 

  Text Type (Simulate Keystrokes): <CTRLD>f<CTRLU>forgot your password?
  Delay: 250 milliseconds
  Text Type (Simulate Keystrokes): <ESC>   // escape from Firefox "find" mode
  Text Type (Simulate Keystrokes): <SHIFTD><TAB><TAB><TAB><TAB><SHIFTU>
  Delay: 250 milliseconds
  Text Type (Simulate Keystrokes): name<TAB>
  Text Type (Simulate Keystrokes): password

 

 

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, TheIdol said:

I have now resorted to using Tabs to select the first field and subsequent ones.  Not Ideal but it works .

 

On the contrary, tabbing is a super reliable way to navigate. The method usually eliminates the need to know, predict, or figure out the coordinates of individual fields; and when text must be copied, the method sometimes eliminates the step of selecting the text (because the act of tabbing automatically selects the entire field).

 

I've written macros that tab through many fields, copying content as each field gets focus. These tabbing macros act fast and rarely fail.

  • Like 1
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...