FindWindowWithText

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

FindWindowWithText

Post by pgriffin » Mon May 16, 2005 4:59 pm

If I use the following syntax:

FindWindowWithText>SomeApp,1,Result

shouldn't the Window containing the text "SomeApp" act as if I have used Setfocus on the same window?

I have two instances of the same app running and want to toggle between them based on some text I have placed on the respective windows. Setting the 'setfocus_flag' to 1 doesn't seem to work.

thanks,

SkunkWorks

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon May 16, 2005 5:56 pm

Is it finding the window you think it is? What is in Result?
MJT Net Support
[email protected]

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon May 16, 2005 9:18 pm

Result is returning the expected window name, but the window is not the active window....not as if I used setfocus.

I have a workaround now in which I SetControlText to one of the system window which writes to the window title bar,then I setfocus to the variable I call %Screen%.....

thanks

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 » Mon May 16, 2005 9:32 pm

I am curious about
Setting the 'setfocus_flag' to 1 doesn't seem to work.
There is no "flag" for set focus. You cannot do Let>setfocus_flag=1.

There is a SetFocus> command. It takes the name of the Window that you want to move the focus to.

Like this:

Code: Select all

SetFocus>Notepad*
You are not providing sample of the code so it is hard to determine why you cannot set focus on the correct window. May not be needed now though since it sounds like you have a work-around.
Last edited by Bob Hansen on Tue May 17, 2005 10:03 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Tue May 17, 2005 2:22 pm

Look at the sample syntax for FindWindowWithText>

that is where you will find the 'setfocus_flag' that I am writing about. it is one of the settings for the command.

either way, I have a good, reliable workaround, but am curious why the command seems to show that it will find the window AND set focus to the window, but won't.

thanks

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 » Tue May 17, 2005 10:04 pm

Oops, I forgot you were using FindWindowWithText>.
Sorry about any confusion.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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