Results 1 to 3 of 3

Thread: How to do a command once a day?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    118
    Hi
    I am wrighting a program that needs to send an email once a day. My problem is that it needs to happen only when an internet connection is present. I know how to test and see if the connection is there and I know how to send the email My problem is how to get the program which will be running all the time to send an only oce a day when connected. The computer may not connect everyday nor will it be the same times everyday.
    Any help would be appreciated.
    PAul

  2. #2
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305
    how about having a code in the timer that checks to see if an internet connection is present ... if it is then make ur program send the email ... then have it write the date to a text file ... that way you can check to see if an email was sent for that day or not ...

  3. #3
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    If your program is running all the time, then you might as well set a variable with the date you sent the email. When you check for a connection, say, every hour, also compare the current date with the one in the variable, If you have a connection, and the dates do NOT compare, send an e-mail. Actually, you'd only compare dates, when you have a connection. No need to compare dates if you don't have a connection.
    Or, write the last sent date to the registry:
    Code:
        'To save
        SaveSetting App.Title, "Email", "LastSent", Now
    
        'To retrieve
        LastSent = CDate(GetSetting(App.Title, "Email", "LastSent", DateAdd("d", -2, Now))
        'If there is no setting to retrieve, you'll probably want to sent
        'the email, since no LastSent date was saved.
        'Therefore we set the default date to today - 2 days
    [Edited by r0ach on 11-22-2000 at 03:02 AM]

    r0ach™
    Don't forget to rate the post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width