Jump to content
Macro Express Forums

Window Rearranged? How to Salvage Macro


bilofsky

Recommended Posts

This may be obvious to most Macro Express users, but possibly it will be helpful to some.

 

A macro programmed for a particular window layout will stop working if everything in the window moves. For example, adding or removing an ad bar at the top of a browser window will throw off all the Y coordinates. Switching to a different internet browser, or adding or subtracting a toolbar, might display objects in the same relative positions, but with all coordinates off by the same amount.

 

One fix is to change all the Mouse Move Window commands to the new coordinates. But there's a simpler way.

 

As an example, suppose all the Y coordinates have increased by 10.

 

First, at the start of the macro, set two integers to the X and Y offsets:

 

Variable Set Integer %N98% to 0

Variable Set Integer %N99% to 80

 

Now after every mouse position command

 

Mouse Move Window 384,427

 

insert the command

 

Mouse Move Position %N98%,%N99%

 

This adjusts the Mouse Move Window to the desired new position. And the change is quickly done using copy and paste.

 

If pieces of the window are rearranged, the same technique might be helpful with variations, like using different offset variables for different parts of the window, or changing the variables further down the macro.

Link to comment
Share on other sites

Well, this is ok, but still manual change.... there is even a better way...automatic:

Most time X is not changing, so only need to find an "Y base coodinate" to be the starting point.

To find this point, you use GET PIXEL COLOR to find a well known color point...with a repeat loop in the Y axis !

I did this , it's working well... no more anything to change...

Link to comment
Share on other sites

There may be better ways to navigate to a target than by clicking the mouse cursor. In many browsers, you can reliably navigate to objects by searching for adjacent text. For example, let's say that you want to automatically sign in to a web site. The task is to move the cursor to the "User Name" edit box, enter your user name, then enter your password, etc.

 

In pseudo-code:

 

// Start a search on the page

<CONTROL>f

// Wait for the Find box to receive focus

Wait 200 ms

// Search for the phrase "User Name"

Text Type "User Name<ENTER>"

// Assume search string was found. Escape out of search

Text Type "<ESC>"

// A short delay here may make the script more reliable

Wait 200 ms

// Focus is now on the label next to the field. Tab to it...

Text Type "<TAB>"

// Enter the user name, tab to the password field, and enter the password

Text Type "georgie123"

Text Type "<TAB>"

Text Type "this_is_my_password"

// Activate the "Submit" button. (Pressing Enter does the trick)

Text Type "<ENTER>"

 

In certain browsers, there are even more reliable ways to do this. In Firefox, for example, there is a command that searches only for text that occurs within a hypertext link.

Link to comment
Share on other sites

Alan, thank you for your suggestions, appreciate, I did not think about this SEARCHING TEXT idea... nice to learn another approach.

Most time working ok on different sites. But, here is 2 websites where I your idea is not working so good:

1)http://www.imdb.com/title/tt0499556/

...the search take few seconds...I found it slow... I am using my macro to Imdb...goes about 10 times faster to fill the 2 search boxes

2)http://www.rapidq-france.org/forums/login.php

this one don't work with TAB... any idea on how to reach the box with keys ?

 

Also, I would be interested on Firefox if you can just tell me a bit more on how ? i wish to give a trial...

Problem with firefox... I already tried (but not on last versions...older ones..) to do some GET CONTROL commands but it did not work the way I want...

I am currently using SLIMBROWSER wich does react quite fast & good with GET CONTROL commands on the adress bar and the notification bar.

Did you use a browser with good working GET CONTROL FIELDS ?

 

Regards. James

 

PS: do you have any idea about my UNICODE problem ? see posts:

http://pgmacros.invisionzone.com/index.php?showtopic=4760

http://pgmacros.invisionzone.com/index.php?showtopic=4769

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