Markir Posted February 10, 2005 Share Posted February 10, 2005 Hello, I want to code a program, that save some configuration of the registry in a file. That code works fine. Now, I want repeat it every night automatically, how can I do that? I hope everybody understand my question, because my english is not so good. Thank you for helping me. Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 10, 2005 Share Posted February 10, 2005 (edited) control panel -> scheduled tasks if you want the script to do it the cpu will bounce around from 0-5% all the time but to do it with the script write the code like this (taken from my alarm program) While 1 If @HOUR = $Hour and @MIN <= $MinE and @MIN >= $MinS Then SoundPlay( $File ) Sleep( $Wait * 1000 ) EndIf WEnd change that code to what you want it to do and set the variables to the time you want it to start and the time you want it to end, i will explain better if needed edit: here is an example that runs notepad at 8 every night While 1 If @HOUR = 20 and @MIN <= 0 and @MIN >= 0 Then Run ( "notepad" ) Sleep( 60000 ) EndIf WEnd ta-da! Edited February 10, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Markir Posted February 10, 2005 Author Share Posted February 10, 2005 Thank you for your second script, but there is a problem, here is my code: While 1 If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" ) Sleep( 10000 ) EndIf WEnd --------------------- It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 10, 2005 Developers Share Posted February 10, 2005 Thank you for your second script, but there is a problem, here is my code:While 1  If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then    Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )    Sleep( 10000 )  EndIfWEnd---------------------It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed.<{POST_SNAPBACK}>Sleep(10000) = pause for 10 seconds so yes it will keep on running taskmanager from 21:30:00 till 21:30:59 .. so probably 5 times.you could:- do a runwait so the script will pause till you close taskmanager- use sleep(60000) SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
golfjrr Posted February 10, 2005 Share Posted February 10, 2005 Thank you for your second script, but there is a problem, here is my code:While 1  If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then    Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )    Sleep( 10000 )  EndIfWEnd---------------------It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed.<{POST_SNAPBACK}>This might work.. If not ProcessExists ("taskmanager.exe") then Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" ) Link to comment Share on other sites More sharing options...
Markir Posted February 10, 2005 Author Share Posted February 10, 2005 OK, I use sleep(60000), but how can I can I close the taskmanager.exe after the 60 seconds? Link to comment Share on other sites More sharing options...
golfjrr Posted February 10, 2005 Share Posted February 10, 2005 OK, I use sleep(60000), but how can I can I close the taskmanager.exe after the 60 seconds?<{POST_SNAPBACK}>ProcessClose ( "taskmanager.exe " ) Link to comment Share on other sites More sharing options...
Markir Posted February 10, 2005 Author Share Posted February 10, 2005 Hello golfjrr this doenst work. The taskmanager.exe programm is still open Link to comment Share on other sites More sharing options...
Markir Posted February 11, 2005 Author Share Posted February 11, 2005 Hello, can anybody say me, why this doesn't work? Link to comment Share on other sites More sharing options...
SlimShady Posted February 11, 2005 Share Posted February 11, 2005 (edited) Probably because Task Manager is from Microsoft and they decided to avoid killing it's process.Is it really called taskmanager.exe at your place?Mine is taskmgr.exeEdit:I just started Task Manager and ran ProcessClose("taskmgr.exe") and it worked, Edited February 11, 2005 by SlimShady Link to comment Share on other sites More sharing options...
golfjrr Posted February 11, 2005 Share Posted February 11, 2005 my EXE is taskmgr.exe<{POST_SNAPBACK}>Mine too but I was just quoting the example he gave. I dunno if it is different for different operting systems. It worked fine for me when I used the proper name for my machine. Link to comment Share on other sites More sharing options...
Markir Posted February 12, 2005 Author Share Posted February 12, 2005 Here is my test with another program, but it doens't work. Mey OS is Windows XP with SP2. While 1 If @HOUR = 19 and @MIN <= 45 and @MIN >= 45 Then Run ( "C:\Programme\Microsoft Office\OFFICE11\Excel.exe" ) sleep(60000) ProcessClose ( "EXCEL.EXE " ) EndIf WEnd Link to comment Share on other sites More sharing options...
Markir Posted February 14, 2005 Author Share Posted February 14, 2005 Has nobody an idea? Link to comment Share on other sites More sharing options...
Domonoky Posted February 14, 2005 Share Posted February 14, 2005 Hi.. yes it seems so that the ProcessClose() function does not work correctly with some microsoftprogramms. but i think you could use "PSkill.exe" from PStools from sysinternal (www.sysinternals.com) mfg Domonoky 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