How to automatically run a task at a specified time.


  • Hi everybody, 

    I have my app that sends email to local users of my company when someone click on "Send" button.

    The app can store many emails in separated files and a user can just choose which one to send and click on "Send" button.

    I need now to automate it in order to set a timer to allow the users to enter the time & date for each Email so that the email be sent at that specified time.

    I just need ideas on how to do that professionally. As I was thinking of doing that via a Timer set to 500 ms to check the clock and run the one that match the specified time.

    and maybe check also if the timer did started/run or not. (case where a PC was off)

    Please I need clue 

    Thanks in advance !

    • Edited by LetMeCode Tuesday, March 21, 2017 3:10 PM
    Tuesday, March 21, 2017 3:03 PM

All replies

  • LMC,

    What you've described is a scheduler really - it doesn't matter what it's for.

    Have a look around and you're sure to find several that have been written over the years. I'd suggest that you make it as a stand-alone assembly with one or more events. That way it's not specific to what you're using it for here.

    Checking twice a minute is taxing - unless you really need it to be that sensitive, set it up to check once a minute and let your users know that it's not "to the second" precise.

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, March 21, 2017 3:14 PM
  • Simply add a timer to your program which ticks every minute. 

    Then check if the email has already been sent and if not send it. 

    Of course you need to add a column to your email items "Send". 


    Tuesday, March 21, 2017 3:31 PM