rahulkghosh Posted February 5, 2008 Share Posted February 5, 2008 Hey, I need some help making a script. I'm trying to work on something that will close a process(the process will start up again automatically after it is closed) every 30 minutes. I have the window name of the process and the file that its file name under task manager (.exe). Can someone help me with this? Link to comment Share on other sites More sharing options...
Paulie Posted February 6, 2008 Share Posted February 6, 2008 While 1 $Timer = TimerInit() Do Sleep(100) Until TimerDiff($Timer) > 30*60*1000 ProcessClose(*precess.exe*) WEnd Link to comment Share on other sites More sharing options...
rahulkghosh Posted February 6, 2008 Author Share Posted February 6, 2008 While 1 $Timer = TimerInit() Do Sleep(100) Until TimerDiff($Timer) > 30*60*1000 ProcessClose(*precess.exe*) WEnd Ah, it says "Error: Missing separator character after keyword." The porcess I want to close is game.exe. The error is around line 6 apparently. Link to comment Share on other sites More sharing options...
Paulie Posted February 6, 2008 Share Posted February 6, 2008 lol you were supposed to replace the "*precess.exe*" with "game.exe" Link to comment Share on other sites More sharing options...
rahulkghosh Posted February 6, 2008 Author Share Posted February 6, 2008 lol you were supposed to replace the "*precess.exe*" with "game.exe"I know..While 1$Timer = TimerInit()DoSleep(100)Until TimerDiff($Timer) > 1000000ProcessClose(game.exe)WEndStill get error when I put this into an .au3 file and run it. Link to comment Share on other sites More sharing options...
Achilles Posted February 6, 2008 Share Posted February 6, 2008 "game.exe" not game.exe... "game.exe" shows that it is a string, which is something the function (ProcessClose) needs to know. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
rasim Posted February 6, 2008 Share Posted February 6, 2008 Why used 2 loops, when can use one loop? HotKeySet("{Pause}", "Quit") While 1 Sleep(1000 * 60 * 30) ProcessClose("game.exe") WEnd Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
tannerli Posted February 6, 2008 Share Posted February 6, 2008 Why used 2 loops, when can use one loop? HotKeySet("{Pause}", "Quit") While 1 Sleep(1000 * 60 * 30) ProcessClose("game.exe") WEnd Func Quit() Exit EndFunc The idea is not bad but this script will not exactly do what Piano_Man wants because the Sleep() function uses seconds as unit while TimerInit()/TimerDiff() uses Milliseconds. Your script would sleep 500hours everytime between killing the process. Just remove the *1000 to get the desired effect Greets tannerli Link to comment Share on other sites More sharing options...
rasim Posted February 6, 2008 Share Posted February 6, 2008 The idea is not bad but this script will not exactly do what Piano_Man wants because the Sleep() function uses seconds as unit while TimerInit()/TimerDiff() uses Milliseconds. Your script would sleep 500hours everytime between killing the process.Just remove the *1000 to get the desired effectGreets tannerliWhat? See in the help file, what uses a Sleep(). Link to comment Share on other sites More sharing options...
Kip Posted February 6, 2008 Share Posted February 6, 2008 (edited) Paulie's script should work great. I dont see a reason why we're still talking about how many loops there should be. And if there should be Timer...() or Sleep() Edited February 6, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now