prpldodge 0 Posted February 12, 2004 Share Posted February 12, 2004 Does anyone have an idea how to create a script that will run say every half hour. or even just once a day With out havening to do it manually I have a script that backs up a file to another computer. Thanks Alan Link to post Share on other sites
Valik 481 Posted February 12, 2004 Share Posted February 12, 2004 Windows task scheduler? Link to post Share on other sites
prpldodge 0 Posted February 12, 2004 Author Share Posted February 12, 2004 It needs to run on windows nt 4.0 server Link to post Share on other sites
prpldodge 0 Posted February 12, 2004 Author Share Posted February 12, 2004 I wold still like to know how it might be done using AutoIt maybe with some sort of loop but I have found a free Windows Scheduler at http://www.splinterware.com/products/wincron.htm.I will give this a try. Link to post Share on other sites
Helge 3 Posted February 12, 2004 Share Posted February 12, 2004 What about doing a loop and add a sleep in it ? While 1 Sleep(60000) MsgBox(0, "Title", "I've been waiting for 1 minute!") Wend Link to post Share on other sites
Bartokv 1 Posted February 12, 2004 Share Posted February 12, 2004 It's been a while since I worked with NT4, but I believe that there should be file called "soon.exe" which resides in the System32 directory. I'm not sure if this file comes standard, or within a service pack/resource kit.If the command exists in your environment, then the statement soon 1800 myscript.exe may be used to slate myscript.exe to be executed in 1,800 seconds (30 minutes) from the current time. Simply call the soon utility from your script to schedule execution again in another half hour.If you don't have the soon utlitly, then you'll need to resort to the "at.exe" utility to schedule the tasks. The syntax for the at utility is a little different, but still easy to use. You won't be able to specify the task is to be executed in xx seconds from now, but you can specify the desired time: at 15:30 "myscript.exe"Hope this helps! Link to post Share on other sites
scriptkitty 1 Posted February 12, 2004 Share Posted February 12, 2004 I normally use squeduler, but you can do it in AutoIt very easy. This example will back it up every 30 min. Change the filecopy to run your program if you wish. I normally have things only backup durring business hours, but that is easy enough to add. Just compile it after you are satisfied, and place in the startup. You can also get an Ini file going with filenames, etc, but this is simply a quick example to learn from. Sqeduler is much better, due to permisions, login passwords, ect. You can always have it run this once a day at say 9:00am, and have it turn it off if running for over 8 hours, and bam you have it backing up from 9~5 every 30 min. Winclose("MyBackup"); make sure only one is running sleep(1000) AutoItWinSetTitle ("MyBackup") AutoItSetOption("TrayIconHide", 0);1 = Hide Icon change to hide if you like. $done="" While 1 For $i=0 To 3; really only need 0 and 3 for once every 30 min If int(@MIN /10)=$i and $i<>$done Then FileCopy ("c:\myfile.txt","C:\backup\myfile.txt",1); change this to suit you $done=$i ; once done, this will make sure it doesn't till the next time EndIf Next sleep(1000); slight delay saves CPU Wend AutoIt3, the MACGYVER Pocket Knife for computers. Link to post Share on other sites
prpldodge 0 Posted February 13, 2004 Author Share Posted February 13, 2004 Thanks Every one I will give it a try Alan Link to post Share on other sites
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