Jump to content
Macro Express Forums

MEP and WPF?


Recommended Posts

Does MEP work with a WPF framework?

 

Currently, I'm trying to automate a process whose UI is written in WPF, not the usual Windows Forms. In waiting for the creation of a child window, I use the usually robust 'Wait for pixel color under mouse to equal %Green%, then proceed.' But, in scripting the macro, I launch the Mouse Locator to determine the exact value of the pixel color for which I'm waiting. The mouse locator returns ONLY the value for Light Grey [on my monitor, 13554646], no matter where in the WPF window my mouse is! The window itself has red and green and blue, but the Pixel Colors according to MEP are grey and grey and grey.

 

And if all pixels in the parent window are grey, and all pixels in the child window are grey, that means 'Wait for pixel color' is no longer an option, which is gonna turn my hair flippin' 13554646.

 

ISS, is WPF supported?

 

Everyone else, have any ideas or experience with this?

Link to comment
Share on other sites

I'm not going to be any help but I would point out that from what I understand about WPF is that it's a graphical presentation environment that runs in a web browser so it's not your vanilla graphic object. And given that it is instructed to paint graphics onto a background form perhaps the Get Pixel Color is grabbing the form background color for some reason. I'm not sure what the mechanism is for Get Pixel Color is but I would seem to think it gets that from the display cache meaning what you see is what it returns. IE I've never had GPC ever return anything other than what I get doing a screen capture.

 

Perhaps you could post a URL that demonstrates the bug for us to try.

Link to comment
Share on other sites

... what I understand about WPF is that it's a graphical presentation environment that runs in a web browser so it's not your vanilla graphic object.

 

Some of the development of WPF is occuring in browsers [using Silverlight, for example], yes, but this particular WPF app is actually desktop-based. The head of Development made the analogy that it's like building a addition onto one's home using a completely different architecture: you can live in it, but from the outside it looks a bit 'different'.

 

I know many of us have had our share of headaches in using ME to interact with controls, comboboxes, buttons, et al, in browsers. The problems I've had with standalone apps and ME have always come down to my current capabilities in using ME, and usually browsing these boards give me new ideas, and new ways of approaching a particular problem. In other words, I always had absolute faith in my ability to automate standalone apps with ME.

 

Until now. It's gonna suck if MEP does not play nice with WPF. I hope Insight has some input.

 

 

Perhaps you could post a URL that demonstrates the bug for us to try.

 

Wish I could but, again, it's a desktop application [and proprietary software currently in development].

Link to comment
Share on other sites

Well let us know how it goes, I'm interested in hearing what the scoop is. It was an odd coincidence I was just reading on WFP so you've piqued my interest.

Link to comment
Share on other sites

post-3982-1246306578_thumb.jpg

Well let us know how it goes, I'm interested in hearing what the scoop is. It was an odd coincidence I was just reading on WFP so you've piqued my interest.

 

Well, on the bright side, this is not an issue specific to MEP; it is also visible in ME3 as well as AutoIt. [Darn it! I was hoping for a workaround with AutoIt, if nothing else.]

 

I've attached a busy screenshot of AutoIt's and ME3's Mouse Locators simutaneously looking at pixels not visible in the WPF window. AutoIt has a nice feature of a Zoom window for accurate pixel location, which actively shows the pixels under the mouse, which is why I included AutoIt in the screenshot--as well as a sanity check for ME3's Mouse Locator.

 

This may be one that I throw back into the laps of the developers; maybe they should have to come up with a standalone app for picking up the pixel color in a WPF window.

 

Well, I can hope, can't I? :)

Link to comment
Share on other sites

I am not familiar with WPF, but there is usually more than one way to skin a cat with Macro Express. Here are other approaches that might work:

 

1. Move the cursor to (x,y), and test the shape of the mouse cursor.

 

2. Move the cursor to (x,y), move it along a straight line in 1 pixel increments, and test for changes in the shape of the mouse cursor.

 

3. If the mouse cursor changes shape when, for example, updating a screen, lock the cursor to a fixed position, and monitor changes in the shape.

 

4. Select text -- perhaps the entire screen -- and copy it to the clipboard. Test the content of the clipboard for key words.

 

5. If there is an address line that gives hints about the window, copy the address to the clipboard, and test it for key words.

Link to comment
Share on other sites

I am not familiar with WPF, but there is usually more than one way to skin a cat with Macro Express. Here are other approaches that might work:

 

1. Move the cursor to (x,y), and test the shape of the mouse cursor.

 

2. Move the cursor to (x,y), move it along a straight line in 1 pixel increments, and test for changes in the shape of the mouse cursor.

 

3. If the mouse cursor changes shape when, for example, updating a screen, lock the cursor to a fixed position, and monitor changes in the shape.

 

For those 3 methods be aware that If Mouse Cursor doesn't work in ME Pro (in contrast to ME 3) as identified in Mouse Cursor commands don't work?

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

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Sorry. I guess I probably should have divulged more of what I understand about the issue—not that that equals much... :)

 

What I'm seeing is from an add-on app to a WinForms program; the app uses WPF. The WPF windows that are generated by this app can be manipulated by keystrokes [such as <TAB><TAB><ENTER>] and even accepts MEP-generated text in textboxes, etc. But to the Pixel Color in the Mouse Locator tool, these windows just are not there. The pixel color is whatever is beneath the WPF window [or windows; at one point there are two WPF windows stacked, and the pixel color sees only the underlying WinForms pixels].

 

With that said, I'll have to look at some of your workarounds, Alan. I haven't noticed if I can cue off of the mouse cursor, so I'll report back. Thanks for the alternatives.

 

I will file a bug report with Insight about this limitation.

 

There's an interesting WPF webpage that confirms what looks like a general WPF/WinForms issue, and code for a workaround, which might be a seed for a solution in MEP. Pixel-color-under-mouse. I am a bit amazed that this info is almost two years old, especially if WPF is "the future", according to some developers. But, like any transition, there's bound to be headaches...

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