Sign in to follow this  
Followers 0
BreCalmor

[Solved] How to exit script when IE is closed

13 posts in this topic

#1 ·  Posted (edited)

If the IE window identified by $oIE is closed by someone or something, I would like the script to exit.

Any help would be appreciated.

Thanks,

Bre

Edited by BreCalmor

Share this post


Link to post
Share on other sites



If the IE window identified by $oIE is closed by someone or something, I would like the script to exit.

Any help would be appreciated.

Thanks,

Bre

Algorithm:

While (mywindows exists)

  myactions here...

WEnd

Exit

Share this post


Link to post
Share on other sites

So, how do I figure if it exists? Probably something to do with the windows handle, but a search through the help and udf help didn't come up with anything I thought would work.

Bre

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If ProcessExists("process") Then
   Actionshere
Else
   Exit
EndIf

Edited by Dinosaurr

Share this post


Link to post
Share on other sites

If ProcessExists("process") Then
   Actionshere
Else
   Exit
EndIf
This requires a name or a pid. I will have a multiple IE windows open with the same title. So how do I find the PID if all I have is the hwnd?

Share this post


Link to post
Share on other sites

WinExists? Didnt look too well into the helpfile.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

WinExists? Didnt look too well into the helpfile.

Which part of "I will have a multiple IE windows open with the same title." did you miss.

Identifying a specific IE window by title WON'T WORK.

Next...

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Which part of helpfile did you miss?

EDIT::

MsgBox(0, "", WinExists(WinGetHandle("")))
Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

In my helpfile I have this (under IE management UDF):

_IEPropertyGet($oIE, "hwnd")

True, which is what I have, but nothing to do with it... I don't see a function that checks the existence of an application by hwnd, only by exe, pid, title or what not. If I could figure out a way to get the PID for a particular HWND, then the problem would be solved.

Which part of helpfile did you miss?

EDIT::

MsgBox(0, "", WinExists(WinGetHandle("")))
WinGetHandle ( "title" [, "text"] )

I will have a multiple IE windows open with the same title.

Guess I don't need to say any more...

Wanna try again, or are you going to actually read my post?

Edited by BreCalmor

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I guess you didnt try out my example. How about you TRY it first?

EDIT::

Heres a tip. REPLACE THE WINGETHANDLE, TO THE IE HANDLE?

MAGIX?

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I guess you didnt try out my example. How about you TRY it first?

EDIT::

Heres a tip. REPLACE THE WINGETHANDLE, TO THE IE HANDLE?

MAGIX?

I didn't try it out, sorry. According to the help file, it shouldn't have worked.

I did see your edit and tried it:

$oIE = _IECreate ($sWebSite, 0, 1, 1, 1)
$hWnd_Active = _IEPropertyGet($oIE, "hwnd")
While WinExists ($hWnd_Active)
   ; All the program stuff
Wend
This does appear to work, although I don't know why. The help file doesn't say you can use a hwnd, and you didn't say you could.

Sorry to have doubted, but maybe explaining it a little would have made more sense.

Thank you for your help and solution !!

Share this post


Link to post
Share on other sites

Anytime.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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