Author Topic: Steve's Task Scheduler  (Read 725 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Steve's Task Scheduler
« on: June 27, 2020, 10:24:53 pm »
Folks were talking about writing a task scheduler over in the topic here: https://www.qb64.org/forum/index.php?topic=2720.0 , so I figured I'd take a shot of throwing a very simple one together.

Note, this is a work in progress, and at the moment, this does nothing more than show how I'd envision the interface to look for the program.  It's quite compact, and quite full of junk at the moment, but there's still some valuable real estate left on the screen which could be used for additional notes or flags.

What this little program will do, (once it's fleshed out better), is allow us to enter up to 71 events on to the screen to track and schedule.

Information tracked (and this information is generally going to be entered in a left to right style line by line in the program) currently is:

Active -- Is this event actively scheduled to occur or not.
Event -- The path and name of the program which we want to shell out to.
7 Days of the Week -- A quick click selection of which of the days of the week we want to run this event.
Start Time -- When the event should start/launch.
Repeat Time -- How often should we repeat this event. 
Stop Time -- When should we stop running this event.

There's some room currently left on the screen which isn't being used.  Is there anything else which someone might need a task scheduler to track for them?  Speak up now, and I'll add it to the mix.  If what's there seems to handle all our needs, then I'll probably just move the timers further to the right and extend more characters to the path and name for folks.

Anywho....  Take a look, see how the format looks, offer suggestions for things which might be missing, and I'll expand functionality as time and life allows.

Code: QB64: [Select]
  1. TYPE Time_Type
  2.     Hour AS _BYTE
  3.     Minute AS _BYTE
  4.     Second AS _BYTE
  5.  
  6.  
  7. TYPE Schedule_type
  8.     Active AS _BYTE
  9.     Name AS STRING * 100 'if you need more than 100 characters for the name/path, adjust this and make your own scrolling/entry routines.
  10.     Days AS _UNSIGNED _BYTE
  11.     Start AS Time_Type
  12.     Repeat AS Time_Type
  13.     Finish AS Time_Type
  14.  
  15. SCREEN _NEWIMAGE(1280, 720, 32)
  16.  
  17. DIM SHARED Events(0 TO 70) AS Schedule_type
  18.  
  19. DrawBoard
  20.  
  21.  
  22. SUB DrawBoard
  23.     COLOR White, 0
  24.     FOR i = 0 TO 70
  25.         LINE (0, i * 10)-STEP(1279, 10), -1, B
  26.         IF Events(i).Active THEN
  27.             LINE (1, i * 10 + 1)-STEP(8, 8), Green, BF
  28.         ELSE
  29.             LINE (1, i * 10 + 1)-STEP(8, 8), Red, BF
  30.         END IF
  31.         LINE (0, 0)-STEP(10, 709), -1, B
  32.         _PRINTSTRING (11, i * 10 + 2), "This is a placeholder for where your event names will go.  As you can see, it can hold many letters."
  33.         FOR j = 1 TO 7 'for the 7 days of the week
  34.             LINE (800 + 10 * j, i * 10)-STEP(10, 10), -1, B
  35.             IF Events(i).Days AND 1 THEN 'sunday is active
  36.                 LINE (811, i * 10 + 1)-STEP(8, 8), Green, BF
  37.             ELSE
  38.                 LINE (811, i * 10 + 1)-STEP(8, 8), Red, BF
  39.             END IF
  40.             IF Events(i).Days AND 2 THEN 'monday is active
  41.                 LINE (821, i * 10 + 1)-STEP(8, 8), Green, BF
  42.             ELSE
  43.                 LINE (821, i * 10 + 1)-STEP(8, 8), Red, BF
  44.             END IF
  45.             IF Events(i).Days AND 4 THEN 'tuesday is active
  46.                 LINE (831, i * 10 + 1)-STEP(8, 8), Green, BF
  47.             ELSE
  48.                 LINE (831, i * 10 + 1)-STEP(8, 8), Red, BF
  49.             END IF
  50.             IF Events(i).Days AND 8 THEN 'wednesday is active
  51.                 LINE (841, i * 10 + 1)-STEP(8, 8), Green, BF
  52.             ELSE
  53.                 LINE (841, i * 10 + 1)-STEP(8, 8), Red, BF
  54.             END IF
  55.             IF Events(i).Days AND 16 THEN 'thursday is active
  56.                 LINE (851, i * 10 + 1)-STEP(8, 8), Green, BF
  57.             ELSE
  58.                 LINE (851, i * 10 + 1)-STEP(8, 8), Red, BF
  59.             END IF
  60.             IF Events(i).Days AND 32 THEN 'friday is active
  61.                 LINE (861, i * 10 + 1)-STEP(8, 8), Green, BF
  62.             ELSE
  63.                 LINE (861, i * 10 + 1)-STEP(8, 8), Red, BF
  64.             END IF
  65.             IF Events(i).Days AND 64 THEN 'saturday is active
  66.                 LINE (871, i * 10 + 1)-STEP(8, 8), Green, BF
  67.             ELSE
  68.                 LINE (871, i * 10 + 1)-STEP(8, 8), Red, BF
  69.             END IF
  70.             _PRINTSTRING (812, i * 10 + 2), "S"
  71.             _PRINTSTRING (822, i * 10 + 2), "M"
  72.             _PRINTSTRING (832, i * 10 + 2), "T"
  73.             _PRINTSTRING (842, i * 10 + 2), "W"
  74.             _PRINTSTRING (852, i * 10 + 2), "T"
  75.             _PRINTSTRING (862, i * 10 + 2), "F"
  76.             _PRINTSTRING (872, i * 10 + 2), "S"
  77.             LINE (881, i * 10)-STEP(70, 10), -1, B
  78.             _PRINTSTRING (885, i * 10 + 2), "HH:MM:SS"
  79.             LINE (951, i * 10)-STEP(70, 10), -1, B
  80.             _PRINTSTRING (955, i * 10 + 2), "HH:MM:SS"
  81.             LINE (1021, i * 10)-STEP(70, 10), -1, B
  82.             _PRINTSTRING (1025, i * 10 + 2), "HH:MM:SS"
  83.         NEXT
  84.     NEXT

Note 2:  I don't imagine the finished version would have all the text spamming wildly across the screen, cluttering it up in such an insane manner.  Most everything would be black space, unless active, so it wouldn't look as cluttered as it currently does.  What you see here is basically just  positional placeholders so I can get everything lined up properly for the next step of development.  (And to see how much space I have left to add or change things on the screen.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!