Finding SECOND occurance of window with Specific Name

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Finding SECOND occurance of window with Specific Name

Post by dbish » Sun May 02, 2004 5:32 pm

My Task: I run a Norton AntiVirus system scan each night via a Msched program with a command line to start the program. After the scan runs it comes up with a Summary box (xxx files scanned, no viruses found, took 33 minutes, etc).

I am now trying to have another Msched script run to close this box. When I try to use a Find Windows command I come up with a Norton AntiVirus window that is connected to a different part of Norton AntiVirus (the always running Auto-Protect). This module is loaded on startup and shows up first in list of system windows. I have tried using Find Window with Text command but Msched doesn't seem to be able to find any of the text. Is there a way to tell Msched to:

Find Window called Norton AntiVirus
- now find the next instance of it and set focus?

Thanks

Dave

Lumumba

Post by Lumumba » Mon May 03, 2004 7:50 am

Maybe this works:

Resize the AutoProtect Window to a specific size (if its not in the tray :wink: ). ResizeWindow>
Run the NAV scheduled task maximized. WindowAction>
Run trough all (active) windows and detect the size. GetActiveWindow>
Leave the focus at the NAV window with the non specified size/max.

Maybe GetWindowPos> soves the whole issue cause a tray icon should appear in a predefined area of the screen (the TaskBar :!: ).

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Mon May 03, 2004 1:26 pm

I like the idea because the two Norton windows are distinctly different sizes.

How would you cycle through all the active windows for size? I have seen such code in Visual Basic for Applications (Excel's macro programming) but not in Msched.

Thanks

Dave

Lumumba

Post by Lumumba » Mon May 03, 2004 9:03 pm

ALT+TAB :!:

But that seems not necessary, cause you know:
a) that both windows exist
b) their title

so call'm !

Let>AutoProtectX=200
WindowAction>Norton Antivirus
WaitWindowOpen> ...
GetActiveWindow> ...
If>X>%AutoProtectX%, ScheduledTaskWindow

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Mon May 03, 2004 9:49 pm

Well, duh! I say to myself. I was thinking of some VBA style Windows property and its just Alt-Tab.

Thanks for your input. I will play with this when I get a chance and report back.

Thanks again.

Dave

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Tue May 04, 2004 10:46 pm

Dear Lumumba:

It worked great!

I knew the X dimension - cycled through windows until I find one that is X-Dim=622 and click on the title bar to set focus - Alt F4 and we're done.

Thanks for the help.

Dave

Lumumba

Post by Lumumba » Wed May 05, 2004 10:33 am

Are you shure that there never - ever will open another window with this size (lets assume in 23.452 DD, 8HH, 05MM, 24SS from now ! :lol: )

Better set an additional check for the windows title right after you've set the focus :wink:

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Wed May 05, 2004 1:27 pm

Good idea.

Thanks again

Dave

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