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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Application Running Based on Windows Title 1

Status
Not open for further replies.

drweb

IS-IT--Management
Apr 17, 2002
26
US
Hey All,

I know I can kill apps or check to see if they are running based on the executables name but is there a way to make vbscript look for the windows title of the application instead.
For instance I have this application lets call it SSO.EXE which is a service that runs at startup. Only when a user changes their domain password they will be prompted a box titled "Enter Windows Password" from this application basically since this application needs to know their new password. I want my script to look for the title above in quotes instead of the exe.

Sorry for being longwinded but I need to fix a nuisance in this app.
Thanks in advance
Clay
 
After reading my thread I think there needs to be more clarification.

I want to look for the application title "Enter Windows Password" in a login script and only if the script finds the title in a window it will halt the script until that window goes away.
I am pretty sure I need to use appactivate but not sure how to make it halt the script and continue after the app is closed.

Thanks again
 
I haven't tried it, but what about something like:
Code:
Do While oWsh.AppActivate "Enter Windows Password"
    WScript.Sleep 1000
Loop

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thank you TomThumbKP,
I incorporated that into my startup script and it tested perfectly.
I do have a question on how to not keep it in an infinite loop. Can I make it end the DO command say after 15 minutes so the script just isn't sitting their in a loop if the user still does not decide to fill in the enter password box?
 
Code:
nWaitIncrement = 1000
nWaitCount = 0
nWaitLimit = 900
Do While oWsh.AppActivate "Enter Windows Password" And nWaitCount < nWaitLimit
    WScript.Sleep nWaitIncrement
    nWaitCount = nWaitCount + 1
Loop

This should go on after 15 minutes even if the window is still present.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Once again thank you for your post.

Works great. Now I have one less nusance to worry about.
 
Hey TomThumb or anyone who is better than me at vbscript :),

Does running a loop too long make anything unstable?

 
I don't think it would make anything inherrently unstable. It will use some system resources, but I don't think the drain would be that great.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top