Jump to content

Kill a process launched by Auto IT


Recommended Posts

I am working on writing a quick app that would poll my gateway on a regular basis to retrieve specific information. In this case the Transmit and Receive byte counts. I initially starting by using _INetGetSource but gave up on that when I could not quite figure how to handle some of the ambiguous items that were returned. I have now moved to using _IETableGetCollection as it makes it far easier to pick specific information from the data returned.

The problem I have now is that for each time that I run the script, an instance of IE is left open and I have to go back and kill them. IE is not my default browser, prefer to use Firefox. Is there some way that the PID of the IE instance that was opened can be obtained so I could run taskkill or other method to remove it?

Here is the beginnings of my script.

#include <IE.au3>
#include <inet.au3>
#include <file.au3>
#include <array.au3>
#include <date.au3>

$oIE = _IECreate("http://192.168.1.254/xslt?PAGE=C_2_0",0,0,1,0)
$oTable = _IETableGetCollection($oIE,4)
$aTableData = _IETableWriteToArray($oTable)
_ArrayDisplay($aTableData)

MsgBox(0,"Results",$aTableData[1][2]&" "&$aTableData[1][3])

The extra includes are from another script I am piecing this together with. Thank you in advance.

Link to comment
Share on other sites

use _IEQuit($oIE) at the end of your script?

or:

OnAutoItExitRegister("_AutoItExit")
Func _AutoItExit()
    _IEQuit($oIE)
EndFunc

was that what you wanted?

also, run() returns the PID of a process, but i don't think thats what you want...

[font=arial, sans-serif]How is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain. Remember when I took that home winemaking course, and I forgot how to drive?[/font][font=arial, sans-serif]<div>This is how you annoy a web developer.</span>[/font]

Link to comment
Share on other sites

use _IEQuit($oIE) at the end of your script?

or:

OnAutoItExitRegister("_AutoItExit")
Func _AutoItExit()
    _IEQuit($oIE)
EndFunc

was that what you wanted?

also, run() returns the PID of a process, but i don't think thats what you want...

The _IEQuit($oIE) did just the trick. Don't know why I did not see it earlier while looking at the help. Now to close the "Make IE your default browser" window. I think I can get that one with a little WinExists action. Here's my solution to that for reference. Thanks for the help!

if WinExists("Internet Explorer") Then
    ControlClick("Internet Explorer","","Button2")
EndIf
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...