Closing down Internet Explorer unlimted times

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
cyman1964uk
Newbie
Posts: 3
Joined: Mon Mar 14, 2005 7:52 pm
Contact:

Closing down Internet Explorer unlimted times

Post by cyman1964uk » Mon Mar 14, 2005 8:20 pm

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
Simon H

I've got the http://www.Silliest.Name

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Mar 14, 2005 9:07 pm

Hi,

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]

cyman1964uk
Newbie
Posts: 3
Joined: Mon Mar 14, 2005 7:52 pm
Contact:

Post by cyman1964uk » Tue Mar 15, 2005 12:30 am

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
Simon H

I've got the http://www.Silliest.Name

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Mar 15, 2005 8:58 am

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.
MJT Net Support
[email protected]

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Mar 15, 2005 4:38 pm

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.

cyman1964uk
Newbie
Posts: 3
Joined: Mon Mar 14, 2005 7:52 pm
Contact:

Post by cyman1964uk » Tue Mar 15, 2005 10:23 pm

Thanks guys!

I think I'll go with the PSkill as it's so simplistic.
Simon H

I've got the http://www.Silliest.Name

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Mar 24, 2005 2:14 pm

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
MJT Net Support
[email protected]

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