Jump to content
Sign in to follow this  
ken82m

Get PID from _IECreate Instance? [Solved]

Recommended Posts

ken82m

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

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
ken82m

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


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites
GoogleDude

Sorry to revive an old post but it help me almost do what I wanted to. Problem now is that it closes all IE Tabs including other IE windows that I have open. how can I get it to only close the tab or window that was created with _iecreate?

Thanks,

~GD

Share this post


Link to post
Share on other sites
GoogleDude

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

Share this post


Link to post
Share on other sites
DaleHohm

Use _IEQuit($iepid)

  • Like 1

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.