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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Iexplore after timeout

Status
Not open for further replies.

Thrakzog

Technical User
May 17, 2002
2
0
0
US
I have a script that starts Internet Explorer in NOTvisible mode, seen only in the TaskManager (Win98). Is there a clean way to close Iexplore after a pre-selected time, regardless of whether the first app is still running or not, and without making it visible?

Script is as follows:
Code:
Dim aWSHShell, bWSHShell
Set aWSHShell = CreateObject("WScript.Shell")
aWSHShell.Run "RemoteRecall.exe"
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore [URL unfurl="true"]http://www.tek-tips.com",[/URL] 0
WScript.Sleep 1800000
...
 
hi
can i have the full script please?
 
Problem, for most part, has been resolved. Some issues still remain, like handling Pop-Up windows, but i think I saw a solution to that somewhere. "Notepad.exe" was used for testing purposes but any App will work. Full script follows:

******************************
'works on a local machine, attached to a network, running Win98SE,
' w/ WSH v2.6 installed
'DOES NOT HIDE POP-UP WINDOWS

Dim aWSHShell, bWSHShell, DOW, intTimeLag
Set aWSHShell = CreateObject("WScript.Shell")
aWSHShell.Run "notepad.exe"
'set url by day of week
'hide the IE window from the desktop
DOW = Weekday(Now())
If DOW = 2 Then 'monday
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore End If
If DOW = 3 Then 'tuesday
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore End If
If DOW = 4 Then 'wednesday
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore End If
If DOW = 5 Then 'thursday
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore End If
If DOW = 6 Then 'friday
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore End If
'windows measures time in milliseconds--1000ms=1sec, 60000ms=1min, etc.
'make the sleep time random so IE is not open the same amount of time each day
'max time open is 30 min
randomize()
randomNumber=Int(30 * rnd())
intTimeLag=randomNumber * 60000
WScript.Sleep intTimeLag
'kill ALL instances of IE
For each Process in GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_Process where Name='Iexplore.exe'")
Process.Terminate
Next
***********************
 
i have a couple questions about the script hope you can anser them.

how would you have the IE window you just opened, close
after 10 seconds has passed?

How would you have it so the scripts randomly chooses different URLs to open, no matter the day or time?

and finally, is there a way to put a timer in the script
so say after every 30secs a new window would pop up with the randomized URL?

thanks for your help.
 
ah 1 more question to add to the list.

is it possible to make everything that the script does
(opening the window,closing the window,randomizing URLs) invisible to the user?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top