Jump to content

Get PID from _IECreate Instance? [Solved]


ken82m
 Share

Recommended Posts

Is it possible to get the PID of the process created by _IECreate

The page my script is going to sometimes triggers a MsgBox relating to MediaPlayer about upgrading some DRM licenses.

I get what I need and issue an _IEQuit but it won't close while that pop up is there.

Is it possible to get the PID so I can issue a ProcessClose() in case _IEQuite doesn't work?

Thanks,

Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

  • Moderators

WinGetProcess(_IEPropertyGet($o_ie, "hwnd")) ?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks :mellow:

Based on your idea I just added this to my IE.au3 under _IEPropertyGet in case I need it again.

Case $s_property = "PID"; Added by Kenny - Based on HWND
   If Not __IEIsObjType($o_object, "browser") Then
      __IEErrorNotify("Error", "_IEPropertyGet", "$_IEStatus_InvalidObjectType")
      SetError($_IEStatus_InvalidObjectType, 1)
      Return 0
   EndIf
   SetError($_IEStatus_Success)
   Return WinGetProcess(HWnd($o_object.HWnd())); Will return 0 if PID was not found

Now I can just call

_IEPropertyGet($IE, "PID")

Thanks,

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

  • 4 years later...

I can get the pid and close ie using the below code but even if "Test" is in a seperate ie window all by its self the below code closes ALL ie windows and tabs. im looking to only close the tab or window with title "Test" in the webpage title.

#include <IE.au3>
$iepid = _IEAttach("Test")
$hwnd = _IEPropertyGet($iepid, "hwnd")
Local $pid = WinGetProcess(_IEPropertyGet($iepid, "hwnd"))
ProcessClose($pid)

~GD

Link to comment
Share on other sites

Use _IEQuit($iepid)

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...