Jump to content
Macro Express Forums

Using Different Window Text With Same Window Title


peterbbrown

Recommended Posts

I have a program (Movie Collector) which I don't want to update to the new version. When it starts, a window with title: Collectorz.com Movie Collector 4.10 pops up, with text under the title:

"A newer version of Movie Collector is available, would you like more" (blah blah)

I have a successful macro to close it, using the text under static window control, activated by that same control + text.

The problem is: Movie Collector uses the same window title, but with different text, for other popup messages such as "Are you sure you want to ..." and the macro runs even when the text under the window title is different, and I keep getting error messages saying "The specified control, C1, could not be found"

 

Can I get it to react only to the window title and/or text of window title , but nowhere else when the window title is the same as the activation?

Link to comment
Share on other sites

Can I get it to react only to the window title and/or text of window title , but nowhere else when the window title is the same as the activation?

 

The window title is the window title and if they are exactly the same there's no way to discriminate.

 

You should be able to use the control activation. Are you using control text or index method. I could see that if it’s the index it might be seeing the same control because they both have the same window title. Try doing you “Get control using text” instead. What this does is drill down by looking at the text label instead of the index number. If that doesn't work (but it should) you could set the control text to a var and have an If that would abort the macro unless it's the one you want.

Link to comment
Share on other sites

I think I used the Control text and the marker I pulled to the line with the different text. It shows that way, but still apparently actually ignores the text within the window and reacts the same to any such window.

 

I'll try the If; I've never used it but I keep getting more proficient, especially with the help of this community. Thanks for the suggestion!

Link to comment
Share on other sites

Controls are strange and have some limitations. I went round and round on this recently and I think I have a fair understanding but I always have to think these things thru carefully. One important thing to know is that “Get Control” sounds like an inappropriate name but it is actually apt. You see GC seems like you are recording the control handle to a variable but you are not. It’s more like a set of directions on how to locate a control. Look back in the posts here from me and you will find a problem I had with accessing controls from Outlook message windows that had the same title. I think you are having a similar problem.

 

Here's my post on the matter. Look at the last message.

 

The main trouble is that ME caches the control handles and there is no way to flush the cache. It doesn’t bother looking up the new control handle because it already thinks it knows it. This becomes a problem with windows that have the same title. I found a fix in my macro but I’m not sure what the fix would be in your case if you are using it for activation. So I think using the window title would be the way to activate it but have it do a test. But you might still need my fix to get the right control.

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