How to control multiple windows with the same title.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
bigred
Newbie
Posts: 10
Joined: Fri Jul 16, 2004 7:50 am

How to control multiple windows with the same title.

Post by bigred » Fri Jul 16, 2004 8:18 am

With this program is there anyway to differentiate between two windows with the same title? In another macro program I am using there is an option to select the window based on its "hWnd" or "Class". Is there any way to do that with this program? I noticed in the "View System Windows" tool it is able to tell you the hWnd numbers, but how do I use them?


I really like this program. It feels much more professional than the other one I was using. But seeing as this one costs 4 times as much money, yet doesn't have as many script commands, I am finding the decision difficult.

I am really not trying to criticize here. I really do think this is the superior program. If it could just get some more commands it would be perfect!

Lumumba

Post by Lumumba » Fri Jul 16, 2004 4:24 pm

You've to add the commands/functions which are provided by VBScript :!:
Additionally you could mix up different tools, like described [here...]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Jul 16, 2004 4:53 pm

Depending on what you are doing you can also use the Macro Scheduler commands for FindWindowWithText, GetActiveWindow, and WindowAction with the Window Type variables.

Specifying text without a trailing asterisk will force Macro Scheduler to only look for an exact match.

It is possible to limit the type of windows that WindowAction affects by using the WF_TYPE variable:
Let>WF_TYPE=0 - No Child Windows
Let>WF_TYPE=1 - ALL Windows (Default)
Let>WF_TYPE=2 - Visible Windows Only
Let>WF_TYPE=3 - Child Windows Only

Using these commands you can open, close, hide windows, search for text to make the desired window become the current one.

FindWindowWithText has a footnote to be aware of. Not all text can be detected successfully. Some applications, such as Word Processors, in order to provide their more complex functionality have to display text in the form of graphics, so do not manifest textual data to other applications.

FindWindowWithText uses the same routines as the View System Windows tool. So to see what text can be detected at any particular time use the View System Windows tool. This function is useful when an application has two windows with the same name, and allows the correct one to be located and focused.

The View System Windows tool is on the main Macro Scheduler panel under the Main Menu, Tools option.

Can you provide example of program and window names that you are working with? Can probably help make a script if we can duplicate the same conditions.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Guest

Post by Guest » Sat Jul 17, 2004 7:06 am

Lumumba, oh to use hWnd ID's I have to use VB? I wasn't really looking to learn a new language. I know its easy, but I don't really have the time.
Unfortunately the other program I'm using doesn't have the option to compile its code to a .exe.

Bob, yeah I've looked at those functions. Problem is since the two windows have the exact same name there is no way to differentiate between them with just the name. That is why the hWnd ID is so useful.

Does M/S have an option to rename the window? The other program I was using had that option, which I found very useful.

The program is a piece of software that runs a dedicated server for a game. The title name is "TRON 2.0".

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jul 17, 2004 7:17 am

Of the windows that have identical names, is one of them a child/parent of the other one? Or are they two independent windows that coincidentally happen to have the exact same name? I would bet that one is related to the other in some manner. If that is the case then I think we can use WindowAction to force one of them to be the active window. Once it is active, we probably can do what is needed.

What do you need to do on the window?
Mouse movements, data entry. click on menu options, cut/paste?

I know this is not an answer yet, but I am always challenged by the impossible. Trying to get a better picture of the problem to be resolved. You are asking for a way to get the window name. I am asking why? You want the name to do some type of activity, so I guess I am asking what are you trying to do vs. how you are trying to do it.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

bigred
Newbie
Posts: 10
Joined: Fri Jul 16, 2004 7:50 am

Post by bigred » Sat Jul 17, 2004 7:21 am

Sry that was me... I timed out of the forum.

I could host the program and necessary files to run it. The biggest limitation seems to be the program its self. I end up having to use mouse click commands to copy data, or select windows, and I really don't like doing that.

Does M/S get updated often? If so what are the chances that the creator would add features like extra commands?


EDIT: I guess I was typing as you posted, so I didn't see your reply right away.

They are two separate windows, one is the Dedicated server, one is the game its self. Or it could also be two instances of the server software. In the game/server instance the only difference is the "Class" type. In the server/server instance the only difference is the hWnd ID.

Actually I need to do all of those things. Copy, button click, text entry, and unless I can figure out how to activate the text I want to copy or the text box I want to type in by its "Window Text" or hWnd ID I will need to do mouse clicks also.

Yeah, thats ok. I understand that the better the mental picture you have of my situation the better you will be able to help.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jul 17, 2004 7:36 am

It has been a while since any major upgrade has happened. New commands are frequently provided as a result of user requests. I know of about 5 that were added within a few months of requests that I had made.

The last major upgrade was 9/4/2003. But there have been 12 minor releases since then. Last minor release was on 4/3/04, two new commands were added with other issues being addressed. I know that one of the new commands was a result of problems discussed here in the forum.

Check out "History" in the Help file.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

bigred
Newbie
Posts: 10
Joined: Fri Jul 16, 2004 7:50 am

Post by bigred » Thu Jul 22, 2004 10:33 pm

Anyone want to take a crack at those other Q's I have left?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts