Solved

Close web browser automatically after inactivity?

Posted on 2009-07-08
8
2,285 Views
Last Modified: 2015-01-05
On my Vista computer, i need it to close all web browser windows (IE, Firefox, Safari, Chrome) after 15 minutes of inactivity. This is because we are using a web login system which doesn't logout automatically and will remain logged in even after the computer sleeps. Maybe a script that runs before automatic sleep or hybernate. Other ideas?
0
Comment
Question by:Thomas4019
8 Comments
 
LVL 6

Expert Comment

by:jwenting
ID: 24810861
Even if you were to close those windows that wouldn't log you out from the web applications.
0
 
LVL 17

Author Comment

by:Thomas4019
ID: 24810893
This is a web login application, hosted internally from my router, and it logs out after closing the window.
0
 
LVL 8

Accepted Solution

by:
Nivlesh earned 200 total points
ID: 24811491
This app might be of help.

http://www.bdvnotepad.com/sysscr_en.htm

and you could write a script (download pstools from www.sysinternals.com .. and use the following to create the script

pskill iexplore.exe
pskill firefox.exe
pskill chrome.exe


0
 
LVL 17

Author Comment

by:Thomas4019
ID: 24816004
That looks quite promising, i will try it now.

Thanks for the help.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Assisted Solution

by:TCB1
TCB1 earned 300 total points
ID: 24839314
Also Autoit will do this and much more.

www.autoitscript.com
0
 
LVL 17

Author Comment

by:Thomas4019
ID: 24842034
Could you post a sample autoit script that would run an "exe" or "bat" or shortcut after a specified number of minutes of inactivity.

Now i am having problems with the screensaver way, in that certain programs seem to be preventing the screen saver from launching.
0
 
LVL 10

Assisted Solution

by:TCB1
TCB1 earned 300 total points
ID: 24842803
Here is the script. Download autoit. You have the option to run the script as a .au3 file or you can convert it to an .exe. Change the inactivity time to your liking. I'm attaching the .au3 file. Just take off the .txt at the end.

while 1 ;run the script continuously in the background
      $startmousepos=mousegetpos() ;get the initial mouse position
      $start=TimerInit() ;Start the timer
      $end=timerdiff($start) ;Check the timer
      while $end<10000 ;Loop until timer is greater than 10 seconds (inactive threshold)
            sleep(1000) ;wait 1 second
            $endmousepos=mousegetpos() ;get the mouse position to see if changed
            if $startmousepos[0]<>$endmousepos[0] or $startmousepos[1]<>$endmousepos[1] Then
                  $startmousepos=$endmousepos ;if mouse postion changed, reset mouse position
                  $start=TimerInit() ;if mouse postion changed, reset timer
            EndIf
            $end=timerdiff($start) ;Check timer
      WEnd
      ;Do the following when the inactive threshold is met
      processclose("firefox.com") ;close firefox
      processclose("iexplorer.exe") ;close internet explorer
      processclose("chrome.exe") ;close Google Chrome
      processclose("safari.exe") ;close Safari
      ;May need to confirm the proper process name for each program you want to close.
        ;You can also close the programs via a winclose("Window Name") command. Check autoit docs   for more info.
WEnd
closewebpages.au3.txt
0
 
LVL 17

Author Closing Comment

by:Thomas4019
ID: 31628067
Thanks for your creative solutions.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now