Jump to content

How to close 1 copy of IE, if multiple copies are running


Noddle
 Share

Recommended Posts

Hi,

I'm querying my solar system controller, to pull imformation from it web front end every 5 minutes,

but sometime  IE freaks out and does not close

so how do I close the instance of IE that I open ( forcible, if need be ),  but leave any other instance of IE alone,

this is the  code i'm using to open, and close it.

$oIE = _IECreate("http://192.168.1.5/cgi-bin/home",1,0)
$oTable = _IETableGetCollection($oIE, 0)
$_HomeDataTable = _IETableWriteToArray($oTable)
_IEQuit($oIE)

I do have a rotuine to close all instance of IE, but that not what i'm wanting to do.

thanks for any help

Nigel

Link to comment
Share on other sites

Since you are always setting visibility = 0, you can do a winlist, and loop through to close all the Non Visible instances...like:

$aIE = WinList("[CLASS:IEFrame]")
For $i = 1 To UBound($aIE)-1
    If Not BitAND(WinGetState($aIE[$i][1]),2) Then WinClose($aIE[$i][1])
Next

Will leave any of your visible IE's untouched.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Since you are always setting visibility = 0, you can do a winlist, and loop through to close all the Non Visible instances...like:

$aIE = WinList("[CLASS:IEFrame]")
For $i = 1 To UBound($aIE)-1
    If Not BitAND(WinGetState($aIE[$i][1]),2) Then WinClose($aIE[$i][1])
Next

Will leave any of your visible IE's untouched.

 

Thank you for this,

I looked at how it works,  and came up with this,

#include <ie.au3>
#include<array.au3>

$oIE = _IECreate("http://192.168.1.5/cgi-bin/home",0,0)
$oTable = _IETableGetCollection($oIE, 0)
$_HomeDataTable = _IETableWriteToArray($oTable)

_CloseIE ("192.168.1.5")

Exit

Func _CloseIE ($_PartURL)
    $aIE = WinList("[CLASS:IEFrame]")
    For $i = 1 To UBound($aIE)-1
        If StringInStr($aIE[$i][0],$_PartURL) then WinClose($aIE[$i][1])
    Next
EndFunc

I can also use this on some of my other little "apps" I have wrote,

Nigel

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...