Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Location
    Belize City
    Posts
    16

    Need Help - Sys Tray Timer App

    Hi, I’m trying to create an app that will run in the background when closed and will launch itself at two specified time each weekday and present the user with an audio player with a "listbox playlist" containing one audio for each day. It will flash a message to the user to remind him/her that the audio is to be played, and then it will cue up the correct audio for the current day and wait for the user to click the play button.

    Now this app must not just get the date and time and show it to the user, but instead it should be able to compare the current date and time to the ones specified and launch itself at these times.

    Now I’m trying to set the part where it compares the current time with the ones specified and tell the menu to launch or not. I’m not really getting it correct, please have a look and tell me what am I doing wrong..
    _____________On Timer___________________________________

    date = System.GetDate(DATE_FMT_ISO);
    day = System.GetDate(DATE_FMT_DAYOFWEEK);
    time = System.GetTime(4) ..":".. System.GetTime(3);

    if day == 2 or 3 or 4 or 5 or 6 then
    playtoday = yes
    elseif day == 1 or 7 then
    playtoday = no;
    end

    if time >= 06:15 and <= 06:25 then
    playnow = yes;
    end
    if time >= 09:15 and <= 09:25 then
    playnow = yes;
    end

    if playtoday = yes and playnow = yes then
    Application.Restore();
    end

  2. #2
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    You've got a few problems here:

    1. your time variable is a string not a time number so you can't check its value with time values. You can circumvent this with using String.ToNumber with a proper calculation on your time numbers (sorry, no time here to post the code).

    2. I am not sure you can do a multiple "or" condition (if day == 2 or 3 or 4 or 5 or 6), I would separate this to: if ((day ==2) or (day ==3) or (day ==4)) etc...

    Good luck

    Yossi

  3. #3
    Join Date
    Dec 2003
    Posts
    891
    Here is some code to get you started.
    set the Page On Show timer
    Code:
    Page.StartTimer(1000);
    then in the Page On Timer event
    Code:
    DRTimer()
    and here's the function that is put into Project Global
    Code:
    function DRTimer()
    nStime = System.GetTime(TIME_FMT_MIL);
    sStime = String.Replace(nStime, ":", "", false);
    nStime2 = String.ToNumber(sStime);
    	if nStime2 > 080000 and nStime2 < 080001 then
    	---put your function for the action you want to call here
    	elseif nStime2 > 120000 and nStime2 <= 120001 then
    	---put your function for the action you want to call here
    	elseif nStime2 > 160000 and nStime2 <= 160001 then	
    	---put your function for the action you want to call here
    	end
    end
    This will run your desired function daily at 0800AM, 1200PM, and 1600PM. just change, add, delete the times you desire

  4. #4
    Join Date
    Mar 2006
    Location
    Belize City
    Posts
    16

    Thank u both

    Hey thanks a lot guys, I really appreciate it.

Similar Threads

  1. Creating a Tray Menu
    By d3m0n1x in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 04-29-2006, 08:48 PM
  2. Sys Tray stuff
    By rhosk in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 12-15-2003, 08:19 AM
  3. System trap app & Internet calls
    By Lee_Benson in forum AutoPlay Media Studio 5.0
    Replies: 11
    Last Post: 11-23-2003, 07:15 PM
  4. Using Timer Events
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-22-2003, 02:14 PM
  5. Replies: 14
    Last Post: 06-24-2003, 04:21 AM

Posting Permissions

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