Jump to content
Macro Express Forums

Any way that MEX can distinguish between 2 windows


Recommended Posts

There was something I found while reviewing new features in MEP a long while ago that I couldn't remember but a pal helped my failing memory. I don't know if it will be useful but you might check out the Variable Set Handle - Enumerate Windows with a Specific Title command. It depends on what you're doing exactly but there might be a way to use that.

Link to comment
Share on other sites

Very interesting Cory,

 

in the following macro i tried to create an array variable (windowss) with this command and activate one of those windows. I have two windows with the same name "Kalender - Microsoft Outlook"

 

 

<VARIABLE SET HANDLE Option="\x00" Info="Kalender - Microsoft Outlook" Partial="FALSE" Wildcards="FALSE" Destination="%windowss%"/>

 

<WINDOW ACTIVATE Title="%windowss[1]" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>

 

 

But it does not work. Via a textbox i figured out that both variables windowss(1+2) become "Kalender - Microsoft Outlook" So maybe i have to use this Window Control stuff which i haven´t understood yet.

Link to comment
Share on other sites

I wasn't offering this as a solution to your problem but rather answer the question of whether MEP can distinguish between two windows and the answer is "Yes". Now whether you can use this to solve your problem is another matter. Perhaps you can describe what it is you're trying to do. Obviously if you were only trying to change focus there are no window manipulation commands that will use the handle but I can think of other things one would want to do for which it could be useful.

 

In the samples file there's a tutorial on using controls with Calculator that’s a good exercise. And Joe’s book is pretty cool at explaining.

Link to comment
Share on other sites

Is there any way that MEX can distinguish between 2 windows which have the same name? Maybe by position or size or by selecting it manually in a kind of learnmode?

The learn mode is an excellent idea, if each window has unique characteristics. Write a little macro that checks pixel color at the mouse location, and appends the coordinates and color to a text file. [use a hotkey combination to run the recording macro, because if you actually click the mouse (rather than just position it) the application is likely to do something based on your click.]

 

You can save the pixel color at one point or many points, in a separate file for each window. Then, when another macro wants to distinguish one window from the other, it just reads back each file of window coordinates, checks the pixel colors, and if they match perfectly you have identified the window.

 

I have a whole application based on this method, because the application is web-based and seven different windows all have the same title.

Link to comment
Share on other sites

Is there any way that MEX can distinguish between 2 windows which have the same name?
Another method I have used is, click somewhere on the window (sometimes necessary with web pages), then do CTRL-a to highlight all the text, copy to clipboard, then "IF CLIPBOARD CONTAINS" some text that is unique to one window or the other. Click again on the window to un-highlight.

 

The drawback to this, compared to checking various pixel positions, is that it's visible and potentially disruptive to the user.

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