Hi,
Could anyone provide the script required to do the following simple task:
Assume I have (say) 20 Internet Explorer windows open at an instant. I wish to methodically close down all currently open IE windows. Ideally, I'd like the script to 'work out' how many IE windows are open (i.e. I'd prefer NOT to have to specify how many).
Thank you!
I've got the http://www.Silliest.Name
Closing down Internet Explorer unlimted times
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 3
- Joined: Mon Mar 14, 2005 7:52 pm
- Contact:
Hi,
Try this:
Let>WF_TYPE=2
Label>start
IfWindowOpen>Internet Explorer*
SetFocus>Internet Explorer*
Press ALT
Press F4
Release ALT
Goto>start
Endif
Try this:
Let>WF_TYPE=2
Label>start
IfWindowOpen>Internet Explorer*
SetFocus>Internet Explorer*
Press ALT
Press F4
Release ALT
Goto>start
Endif
MJT Net Support
[email protected]
[email protected]
-
- Newbie
- Posts: 3
- Joined: Mon Mar 14, 2005 7:52 pm
- Contact:
That's great in that it does what I asked!
However, there's a warning at the end ... "Specified Window "Internet Explorer*" Not Present. Any Subsequent Key Sends In Script May Cause Exceptions."
There are options to Abort or Ignore.
Any ideas how to make this warning screen go away? Then it would be perfect!
Thanking you in advance!
Simon.
http://www.silliest.name
However, there's a warning at the end ... "Specified Window "Internet Explorer*" Not Present. Any Subsequent Key Sends In Script May Cause Exceptions."
There are options to Abort or Ignore.
Any ideas how to make this warning screen go away? Then it would be perfect!
Thanking you in advance!
Simon.
http://www.silliest.name
Ah, I see why. If one of the windows takes a while to close the IfWindowOpen will see it and so the script then tries to focus it but by now it has closed. So I should change the script to get the handle of each individual IE window and wait for that to close before continuing. So the script should be like this:
Let>WF_TYPE=2
Label>start
IfWindowOpen>Internet Explorer*
SetFocus>Internet Explorer*
Let>WIN_USEHANDLE=1
GetActiveWindow>handle,X,Y
Press ALT
Press F4
Release ALT
WaitWindowClosed>handle
Let>WIN_USEHANDLE=0
Goto>start
Endif
So we look to see if an Internet Explorer window exists, if so we focus it and get it's unique handle. We then send ALT-F4 to it to close it and then wait for it to close. Then we start over. If no Internet Explorer window exists we exit.
Let>WF_TYPE=2
Label>start
IfWindowOpen>Internet Explorer*
SetFocus>Internet Explorer*
Let>WIN_USEHANDLE=1
GetActiveWindow>handle,X,Y
Press ALT
Press F4
Release ALT
WaitWindowClosed>handle
Let>WIN_USEHANDLE=0
Goto>start
Endif
So we look to see if an Internet Explorer window exists, if so we focus it and get it's unique handle. We then send ALT-F4 to it to close it and then wait for it to close. Then we start over. If no Internet Explorer window exists we exit.
MJT Net Support
[email protected]
[email protected]
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Or you could be less analytical and use Run Program> with PSKILL http://www.sysinternals.com/ntw2k/freeware/pskill.shtml to just kill all iexplore.exe processes.
-
- Newbie
- Posts: 3
- Joined: Mon Mar 14, 2005 7:52 pm
- Contact:
Here's another method:
Terminating Processes and Stopping Services:
http://www.mjtnet.com/forum/viewtopic.php?t=1779
With this you just do:
VBRun>KillProcess,iexplore.exe
Terminating Processes and Stopping Services:
http://www.mjtnet.com/forum/viewtopic.php?t=1779
With this you just do:
VBRun>KillProcess,iexplore.exe
MJT Net Support
[email protected]
[email protected]