Results 1 to 17 of 17

Thread: Trigger time based event

  1. #1

    Thread Starter
    Registered User
    Join Date
    Sep 2002
    Posts
    14

    Trigger time based event

    Hello,

    Anyone knows how to trigger an event based on system time ?
    For example : I want my program to do something at 01:00 AM each day.

    Thanks,

    Jukke

  2. #2
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    What do u mean how to trigger a event.

    If you want to call a function, just call a function.
    If you want to call a event such as command1_click. Click event of command button. Just call it as command1_click().

  3. #3
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Or if you want to Raise a event use RaiseEvent().

  4. #4

    Thread Starter
    Registered User
    Join Date
    Sep 2002
    Posts
    14
    Right, I can execute events by calling the sub.
    Even without events, how can I make my program detect a specific time e.g. 01:00 AM and do something ?

  5. #5
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Have a timer that will fire every 1 second. Interval = 1000
    In timer click event check the system date/time. if matches with your value ... do some thing.

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    I think every 1 sec is a bit excessive ..... maybe every 45 or 60 or even 90 seconds should do....
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Registered User
    Join Date
    Sep 2002
    Posts
    14
    Why didn' I find this myself.
    So easy ...
    Thanks techyspecy !

  8. #8
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Originally posted by techgnome
    I think every 1 sec is a bit excessive ..... maybe every 45 or 60 or even 90 seconds should do....
    Not possible techngome.

    Lets say he wants to check for 1:00 AM

    with 30 sec. timer lets say last time timer got fired at 12:59:45 sec.

    next timer will fire at 1:00:15. and he will miss the 1 o clock time.

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes but he only misses it by 15 seconds and technically its still 1 am its just not EXACTLY with no seconds difference. And then the timer doesn't poll the system near as much making it more effective.

  10. #10

    Thread Starter
    Registered User
    Join Date
    Sep 2002
    Posts
    14
    The trigger doesn't have to be on the second. More or less around the specified time will do the trick.

    Thanks guys !


  11. #11
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Got an idea for your prog.

    You might wanna put your program in the task bar if its running for a specifyed time...

    I can give ya what haz been given to me...

    The taskbar code ... if your want.

    Originally posted by Jukke
    Why didn' I find this myself.
    So easy ...
    Thanks techyspecy !

  12. #12
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    90 seconds could skip over 1:00

    say, 12:59:50 to 1:01:20

  13. #13
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Thats true 90 seconds could skip it, but you can still use 45 or 60 would work. Or 90 if you don't mind the extra 30 seconds.

  14. #14
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    If its not a matter of seconds then he has lot of options ....

  15. #15
    New Member
    Join Date
    Oct 2002
    Location
    CA, USA
    Posts
    3
    Hey Ruku,

    I've been wanting to put something together that combines both the "timer" event (like from the orig. post) combined with the "min. to sys. tray" that you mentioned.

    Think I could get the "task bar" code?

    Thanks,

    ittybitty

    BTW: this is a great board, found it not too long ago and have got a lot of useful info.

    Thanks people.

  16. #16
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    I think there is no problem with any size of timestep (30 sec or even 300 sec) if you do not check for the exact time ( = 01:00). Just check for a timeperiod that is from 01:00 to 01:00 + timestep.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  17. #17
    Junior Member
    Join Date
    Oct 2002
    Posts
    27

    Suggestion again...

    Well similar problems are solved as follows...

    set a timer...
    The timer can only time for about 60,000 ms (1 minute)
    set the delay time to one of the following:
    • another minute if the time you want is MORE than a minute away...
    • the number of seconds left untill that time


    This will get you exactly where you want...

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