MSFN Forum: Question: Application Timer - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Question: Application Timer Anyone know of one? Rate Topic: -----

#1 User is offline   CptMurphy 

  • Just another techie
  • PipPipPipPip
  • Group: Members
  • Posts: 534
  • Joined: 15-October 05

  Posted 30 August 2006 - 06:36 PM

Hello all, I'm looking for a program that will close an application after a certain amount of time has passed. For example, if a user is using a program for ~25mins, after 30mins, the application closes on him/her. It doesn't really matter if the user is notified or not. I'm mainly looking at controlling the amount of time a users spends playin an online game. I found one called CloseApp but that's shareware. I'd like a freeware one if any of you know of one. I've also heard about creating a batch file stating that a program should close. The only problem with this though, is that there'd be no way of starting a timer as soon as the user starts the game. Any help is appreciated.


#2 User is offline   LLXX 

  • MSFN Junkie
  • PipPipPipPipPipPipPipPipPip
  • Group: Banned
  • Posts: 3,399
  • Joined: 04-December 05

Posted 30 August 2006 - 08:08 PM

Windows has killtask and at commands, if you do a little more research you should be able to come up with a way of using those.

#3 User is offline   ripken204 

  • The Hardware Guy
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 6,311
  • Joined: 23-December 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 30 August 2006 - 08:31 PM

well i created an autoit3 program back when i had a crappy laptop. when i would run the sims 2, the program would kill explorer.exe, and when i exited the sims 2, explorer.exe would come back on...

#4 User is offline   Aegis 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Banned
  • Posts: 1,298
  • Joined: 12-March 05

Posted 30 August 2006 - 10:44 PM

@echo off
set /a %time:~3,2%+30 > tempfile
for /f %%i in (tempfile) do set closetime=%%i
start calc.exe
:loop
if %time:~3,2%==%closetime% taskkill /f /im calc.exe
goto loop

There's a bug in the loop code somewhere. Once when you can actually find it (I couldn't :P) and fix it, this batch file should close calc.exe after running for 30 minutes.

#5 User is offline   CptMurphy 

  • Just another techie
  • PipPipPipPip
  • Group: Members
  • Posts: 534
  • Joined: 15-October 05

Posted 31 August 2006 - 12:59 AM

Thanks all, I really appreciate it. Special thanks to Aeigis, Ima work the code now. Thanks man.


View PostAegis, on Aug 30 2006, 09:44 PM, said:

@echo off
set /a %time:~3,2%+30 > tempfile
for /f %%i in (tempfile) do set closetime=%%i
start calc.exe
:loop
if %time:~3,2%==%closetime% taskkill /f /im calc.exe
goto loop

There's a bug in the loop code somewhere. Once when you can actually find it (I couldn't :P) and fix it, this batch file should close calc.exe after running for 30 minutes.




[EDIT]
All right, I decided to use LLXX's method since it's simpler. I just created a batch file with this code
@echo off
taskkill /IM dfbhd.exe /F
taskkill /IM dfbhdlc.exe /F
From here, I scheduled the task to run every 2 hours, every day, for 2 hours and 10 minutes. This should suffice it. Thanks to all who helped me. BTW, the "at" command is actually not very usefull. I just used the task scheduler.

This post has been edited by CptMurphy: 31 August 2006 - 01:29 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy