Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve Window Titles 1

Status
Not open for further replies.

scripto

Technical User
Oct 20, 2003
9
GB
In an Outlook/Exchange environment, Outlook occasionally throws up a "Requesting data" window when the e-mail server is heavily loaded.

I need to detect when this window is displayed.

Can I detect a Windows based on the Window Title with VBScript?

XP has a utility, "Tasklist", which can detect when a window is active based on the WindowTitle. I could run Tasklist from VBScript but would prefer something native.

I have tried listing processes/tasks/threads but cannot identify the "Requesting Data" activity as it is part of the Outlook process. The only unique features I can identify are:
1. The Window Title
2. The Application name in Taks Manager Applications.

Can VBScript access the Title of all open Windows or the names of running Applications as listed in Task Manager.
 
To enum of top level window have had a horrid history using shell.application with the ie version intervening. In any case, the ms standard package of wsh reflects the opinions of the team who makes it, namely, not supporting this functionality and not allowing api called through script for the enum to happen.

The solution I would propose is to use J Richard's component/wrapper JSSys3.dll free downloadable at his site. The joeware has my highest regard for excellence. (A simple google search will bring you there for the latest site, as it seems to be changing a bit for maintenance.)

The highly regarded autoit has also a winlist() function to do that. But, it is supported only on the standalone autoit, not activex autoitx.

The method used by jssys3.dll would be simple and here the the outline.
[tt]
dim sys, ncount, a, i, sinfo
set sys=createobject("jssys3.dll")
ncount=sys.getopenwindowtitles(a)
sinfo=""
for i=0 to ubound(a)
sinfo=sinfo & vbcrlf & a(i)
next
wscript.echo sinfo
set sys=nothing
[/tt]
 
Amendment
I type the wrong progid without thinking! The createobject line should be read like this.
[tt] set sys=createobject("jssys3.[red]ops[/red]")[/tt]
 
Thanks Tsuji

This is helpful.

It means I can stop looking for something in VBScript to do what I want.

I will try your suggestion.

Tek-tips is great

Scripto.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top