Held51 Posted September 5, 2017 Posted September 5, 2017 Hello I'm new to this and I tried to run my program every 15 min with @MIN and I did not succeed, could they help me?
KickStarter15 Posted September 5, 2017 Posted September 5, 2017 @Held51, Welcome to our forum. Day ago I have the same concern as you have however, what I need is per day count, so, I use sleep() function to do my staff but @Melba23 responded me in my inquiry. So, basing of his idea, i made a simple timer that will run your program whenever you want to run your program within that day. HotKeySet("{ESC}", "_Exit") ; just incase you want to end the program $Mins = 15 ; this is where you add your @min $Timer = TimerInit() While 1 If TimerDiff($Timer) > ($Mins * 60000) Then ; count per minute multiplied by 60sec. ConsoleWrite("15 minutes have passed!" & @CRLF) ; console to see if running or what ever you wanted to do. Some staff $Timer = TimerInit() EndIf WEnd Func _Exit() Exit EndFunc Here's my post if you like to have it per day count. KS15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
TheDcoder Posted September 5, 2017 Posted September 5, 2017 3 hours ago, Held51 said: I tried to run my program every 15 min with @MIN and I did not succeed, could they help me? Can you post your script so that we can have a look at what is going wrong? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
FrancescoDiMuro Posted September 5, 2017 Posted September 5, 2017 8 hours ago, KickStarter15 said: @Held51, Welcome to our forum. Day ago I have the same concern as you have however, what I need is per day count, so, I use sleep() function to do my staff but @Melba23 responded me in my inquiry. So, basing of his idea, i made a simple timer that will run your program whenever you want to run your program within that day. HotKeySet("{ESC}", "_Exit") ; just incase you want to end the program $Mins = 15 ; this is where you add your @min $Timer = TimerInit() While 1 If TimerDiff($Timer) > ($Mins * 60000) Then ; count per minute multiplied by 60sec. ConsoleWrite("15 minutes have passed!" & @CRLF) ; console to see if running or what ever you wanted to do. Some staff $Timer = TimerInit() EndIf WEnd Func _Exit() Exit EndFunc Here's my post if you like to have it per day count. KS15 What about AdlibRegister() ? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
KickStarter15 Posted September 6, 2017 Posted September 6, 2017 @FrancescoDiMuro, Yes, that would be great as well to use. But I still need to understand it first how it really works. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
CarlD Posted September 6, 2017 Posted September 6, 2017 (edited) Here's a template showing how I schedule my daily or weekly repeating tasks, at home and at work. Works like a charm. Just make sure that the Sleep value at the end of each task is at least 61 seconds [Sleep(61000)]; otherwise, you'll get more than one instance of the same task running simultaneously. expandcollapse popup; Scheduler.au3 ; Task Scheduler (AutoIt v3) [CLD rev.2/27/17] ; -------------------------------------------- #cs Macro reference: @YEAR 4-digit year @MON Month. Range: 01-12 @MDAY Day of month. Range: 01-31 @HOUR Hour. Range: 00-23 @MIN Minutes. Range: 00-59 @SEC Seconds. Range: 00-59 @MSEC Millseconds. Range: 00-999 @WDAY Numeric day of week. Range: 1-7 (Sunday-Saturday) @YDAY Day of year. Range: 001-366 #ce #include <Misc.au3> _Singleton(@ScriptName, 0) ; Machine ID variables $bHome = False $bWork = False Select Case FileExists("d:\path\foo\*") $bHome = True Case FileExists("e:\path\bar\*") $bWork = True EndSelect ; Path variables Select Case $bHome $sXyDir = "d:\path\foo\xy" $sLocateDir = "f:\Locate32" $svDosDir = "d:\path\foo\vDos" Case $bWork $sXyDir = "d:\path\bar\xy" $sLocateDir = "g:\Locate32" $svDosDir = "d:\path\bar\vDos" EndSelect ; Other variables $sNewsURL = "http://www.wnyc.org/stream/wnyc-fm939/windows.asx" ; ------------------------------------------------------------------- WHILE 1 $iNow = @HOUR & @MIN Select Case $bHome And $iNow = 0000 SoundPlay($sXyDir & "\maid.mp3", 0) MsgBox(0, "It's Midnight...", "Time for sleep!", 60) Sleep(61000) Case $bHome And $iNow = 0005 ShellExecuteWait($sLocateDir & "\Updtdb32.exe") Sleep(61000) Case $bHome And @WDAY = 7 And $iNow = 0025 ShellExecute($svDosDir & "\VDP-checkinstall.exe") Sleep(61000) Case $bWork And ($iNow = 1108 Or $iNow = 1655) Run($sLocateDir & "\Locate32.exe") Sleep(1000) WinActivate("Locate:") Sleep(2000) Send("{F9}") Sleep(5000) WinKill("Locate:") Sleep(100) WinActivate("vDos") Sleep(61000) Case $bWork And $iNow = 1800 Local $curw = WinGetTitle("[active]") If WinActive("media player") Then WinKill("media player") Sleep(500) EndIf ShellExecute(@ScriptDir & "\start.exe", "_ " & $sNewsURL, @ScriptDir, "Open", 1) Sleep(3000) WinActivate("firefox") WinWaitActive("firefox") Sleep(500) Send("^w") WinActivate($curw) Sleep(61000) Case $bWork And $iNow = 1808 WinKill("media player") Sleep(61000) Case $bWork And $iNow = 1825 MsgBox(64, "Reminder: 6:25pm", "Time to go home!", 300) Sleep(61000) EndSelect Sleep(500) WEND Edited September 7, 2017 by CarlD
FrancescoDiMuro Posted September 6, 2017 Posted September 6, 2017 7 hours ago, KickStarter15 said: @FrancescoDiMuro, Yes, that would be great as well to use. But I still need to understand it first how it really works. Ahahahahahah It's quite simple to use Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
KickStarter15 Posted September 7, 2017 Posted September 7, 2017 @FrancescoDiMuro, Yes, and getting started with it. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
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