Sign in to follow this  
Followers 0
Aslam Jeewa

How do I uniquely identify an IE Window

11 posts in this topic

#1 ·  Posted (edited)

Is there a flag or setting I may use to uniquely identify an instance of an open IE window using IE.au3? I need to run a 2nd application that closes a specific instance of an IE window (1 of many accessing the same website) & restarts it. I thought about setting the Title but its overwitten when I "navigate". I also tried

$PID2 = ProcessExists("IEXPLORE.exe") ; Will return the PID or 0 if the process isn't found.

If ProcessExists($PID2) Then Run("taskkill /F /T /IM " & $PID2, "", @SW_HIDE)

but it doesn't necessarily kill the correct instance & I need to uniquely kill 1 instance only..... that I need to identify with a property that I have set....

Any ideas. PLEASE....

Edited by Aslam Jeewa

Share this post


Link to post
Share on other sites



Is there a flag or setting I may use to uniquely identify an instance of an open IE window using IE.au3? I need to run a 2nd application that closes a specific instance of an IE window (1 of many accessing the same website) & restarts it. I thought about setting the Title but its overwitten when I "navigate". I also tried

$PID2 = ProcessExists("IEXPLORE.exe") ; Will return the PID or 0 if the process isn't found.

If ProcessExists($PID2) Then Run("taskkill /F /T /IM " & $PID2, "", @SW_HIDE)

but it doesn't necessarily kill the correct instance & I need to uniquely kill 1 instance only..... that I need to identify with a property that I have set....

Any ideas. PLEASE....

Read in help file about WinList().


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Read in help file about WinList().

Winlist still does not uniquely identify my specific Instance of IE as they both have the same title

Share this post


Link to post
Share on other sites

How are the windows different? You can use IEAttach to match against URL, text, html, hwnd... and others. You can also use instance instead. From there just IEQuit.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

HWnd (Window Handles) are unique codes that identify a window... from that you can get all the info you need... and obvoiously handle the window :)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites

Let me rephrase my problem

I have both IE Windows open - Identical in all terms but the only way I can determine which one to close is if I set something in some property first (because I created both IE windows) say for example the title like "This is IE Window 1" - That would work & I would then "search" for that Title & close the window but Title gets overwitten when I navigate so I cannot use that.

Even hWnd seems to be the same handle for both IE Windows unless I am doing something wrong? So... any ideas?

Share this post


Link to post
Share on other sites

do you talk about windows or tab's`?

I get two different PID's when I open two instances of IE. So maybe you could use the PID to determine witch window to close?

Share this post


Link to post
Share on other sites

referencing:

How are the windows different? You can use IEAttach to match against URL, text, html, hwnd... and others. You can also use instance instead. From there just IEQuit.

Are you certain _IEAttach and _IEQuit do not give you what you need? There are many choices available to you with _IEAttach to find the correct window. Also, if you create the IE windows with _IECreate in the first place you will have a reference to each of them uniquely.

Dale


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

I have now resorted to creating the 2nd applicastion using Forefox & then closing the Firefox application but it doesn't work perfectly all the time (Website is sometimes faulty)

So it seems I have to go back to looking for a way to identify the seperate window if IE & close that particular instance.

SO...

I AM BACK TO SQUARE ONE

Any ideas, PLEEEEEEASE - (_IEAttach cannot uniquely identify the Window, by the way)

Share this post


Link to post
Share on other sites

How do you open your IE windows? In your script, just use

$pid = Run('"' & @ProgramFilesDir & '\Internet Explorer\iexplore.exe" "www.autoitscript.com"')

...

ProcessClose($pid)

;Or

$oIE = _IECreate("www.autoitscript.com")

...

_IEQuit($oIE)


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Note that a single IE PID can be responsible for multiple browser instances, so that later is preferrable.

@Aslam Jeewa - you have provided no evidence as to why _IEAttach and _IECreate are not adequate

Dale


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  
Followers 0