Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
I need to wrap this in a loop to catch IE closing and force a logoff when EI closes.

Can someone help?

Code:
			' Run Core Browser
'			r = objShell.Popup("Running Core Browser", 4, "Member of Browser",48)
			Set objIE=WScript.createobject("internetexplorer.application","iexplore")
			objIE.visible=True
			objIE.AddressBar=False 
			objIE.MenuBar=True
'			objIE.FullScreen=True 

			URL = "//" & strComputer & "/CoreDirector_" & strWksVersion &_
			"/login.aspx?BK=" & strBank
			objIE.Navigate(URL)



Thanks

John Fuhrman
Titan Global Services
 
If you just want to force a logoff whenever IE closes, then I would consider using a WMI event sink. You can find examples of event sink code by searching this forum.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
If you can catch the IE close event, a simple command line "logoff 0" would logoff the current user immediately. So, you could just use "wshshell.run" command to run the "logoff 0".
 
>I figured it would be something with the OnQuit event but was unsure how to do it.

Two things.
[1] Have to keep the script alive until ie application quit and not costing much cpu time.
[2] Script the handling of the ie application. Like this.
[tt]
'etc etc as posted
objIE.Navigate(URL)
'more other tasks of the script proper unrelated to objIE
'dim a bquit global: if the above is within a sub/function, put the following dim at the top level outside of the sub/function.
dim bquit : bquit=false
do while not bquit : wscript.sleep 500 : loop
'etc etc...task to complete after objIE quitted.

sub iexplore_onquit
bquit=true 'raise the global flag
'task to do on objIE quit proper
end sub
[/tt]
[2.1] If the onquit script is performing some task not directly related to and/or within objIE proper, you can just raise the flag, and leave the task performed in the callee as a variant to the above.
[tt]
'etc etc...
do while not bquit : wscript.sleep 500 : loop
'etc etc...task to complete after objIE quitted.

sub iexplore_onquit
bquit=true
end sub
[/tt]
 
I have one more question.

We have about 80 Server in a small DC of which about 40 are Terminal Servers (not citrix) on which the average user load is between 50 and 80 users per server with spikes up to 120 users.

My fear is that I change the script to watch for IE closing and I now have the script running 50 to 100 times and slow the server to a crawl. Anyone have any experience with something like this??



Thanks

John Fuhrman
Titan Global Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top