Hi Everyone,

I'd like to create a script to close a window if it pops up. Here is what I presently have, but it's not perfect. I want the window to close if it pops up, I'd prefer not to use the 'sleep; that's presently in the script.


dim sh
set sh = createobject("wscript.shell")
if sh.appactivate("Microsoft Windows Messenger 5.1 5.1.0700 (English)") then
wscript.sleep 250
sh.sendkeys "%{f4}"
end if
set sh = nothing


0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity



I have tried using VBscript for this purpose before, but have found AutoIt much better for doing these tasks.
I will recommend using AutoIt.

Take a look at http://www.autoitscript.com

Answered 10/10/2005 by: andler
Orange Belt

Please log in to comment
Thank you. I've already created this using Winbatch, but the boss said to use vbscript, so I'm stuck with vbscript.
Answered 10/10/2005 by: Paraleptropy
Yellow Belt

Please log in to comment
You can use autoit with Vbscript.
It is much better for sending keystokes to windows.

Why are you trying to close this window? Why is it popping up?
maybe you need to look at why the window pops up and how to stop it before it does.
Answered 10/20/2005 by: Byoung4now
Senior Yellow Belt

Please log in to comment