Held51

Automatically run program every 15 min

8 posts in this topic

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?

Share this post


Link to post
Share on other sites



@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.:D

 

KS15

Share this post


Link to post
Share on other sites
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?


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
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.:D

 

KS15

What about AdlibRegister() ? :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

@FrancescoDiMuro,

Yes, that would be great as well to use.^_^ But I still need to understand it first how it really works.:sweating:

Share this post


Link to post
Share on other sites

#6 ·  Posted (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.

; 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 by CarlD

Share this post


Link to post
Share on other sites
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.:sweating:

Ahahahahahah :)

It's quite simple to use :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

@FrancescoDiMuro,

Yes, and getting started with it.:lol:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now