MLSchedule Plugin
From Tallus LLC Wiki
Contents |
About
MLSchedule is a MainLobby plugin which allows to schedule MLServer events at various time and/or frequencies. Basically, it is a more powerful version of the MLScheduler included with MLServer. It also can replace MLServer's MLPause command (see "Fixed Interval" below). MLPause drawback is that it stalls MLServer processing during the wait. MLSchedule does not have this limitation which results in a much more responsive overall system.
MLSchedule is now available for purchase.
[MLSchedule Shopping Cart]
Download Link
The plugin installs in a 30 day trial mode. Once you have decided to purchase it from [Tallus's shopping cart], just apply the software license you will receive from Tallus via email on purchase of the plugin. After the plugin is installed, the license is then applied to MLServer3's Software Registration Menu (in MLServer: Help/Manage License Keys) which you must then Activate to that PC by sending your purchased license, your MLServer's Hardware ID (found at bottom of the Registration Menu window) to: info(at)talluscorp.com. You will soon receive an Activation code via email that is applied to the Registration Menu which makes that plugin permenant to that PC.
You should perform the above within the 30 day trial period to enjoy uninterrupted usage of the plugin with no rework needed between trial and licensed useage. Please allow up to two days for Tallus processing time for your requests. Most requests are processed within a few hours.
Requirements
- Tested with MLServer 3.0.588
- MainLobby client 3.0.151
- .NET Framework 2 and 3.5
Configuration
The MLSchedule plugin can be configured through:
MLServer -> View -> Plugins -> MLSchedule -> Settings
From the "Schedule" tab, it is possible to add or modify individual events. The "UI Settings" tab allows to configure the plugin's interface for each individual MainLobby clients. The "Log" tab is there to help debug what is going on...
Examples
Five type (6 if you count Sunrise and Sunset separately ) of events are possible:
1) Fixed interval: the possible intervals span the (1-60) (seconds - months) range. The specified command will be executed when the time is up and the count down will be reset. To repeat a command every 2 seconds, the following command could be enabled:
2) Fixed time: it is possible to select a specific time (0:00 - 23:45 at a 15 minutes interval) at which to execute the command, starting from a specific date. Many choices exists for the frequency, ranging from daily, week days, up to yearly. To execute a command daily at 11:30 PM:
3) End of month: it is possible to setup an event for the end of the month (minus a certain offset). While "Fixed time" might work, something like 31st of January + 1 month is a bit ambiguous... To execute a command 1 minute before the end of each month:
4) MLServer launch: whenever the MLServer (or more precisely the plugin) is restarted, a command can be executed (with an offset). To execute a command 40 seconds after the MLServer has been started:
5) Sunrise/Sunset: a command can be executed at a certain offset from the sunrise/sunset time. Typically, those times are computed from the previous day. While the "Next execution" are incremented daily, the actual event will only be executed if the day matches the selected condition (for example: "weekend"). To set the lights to 30%, 15 minutes before the sunset:
For "Fixed interval" events, should the MLServer be offline for the "next execution", on relaunch the command will be executed and the "last execution" set accordingly .
Enabling a disabled event will reset its "last execution" (does not apply to Fixed time events).
It is also possible to add new events or edit the existing ones through the User's Interface.
MLServeCmd
In order to modify the existing schedule, it is possible to send a simple command using MLSchedule|<Command>~<event>. The possible commands are {Delete|Disable|Enable|Exec|Reset}. Where <event> is the unique name of the event or its position (0 based) in the schedule's list.
To remove "Event 3" from the schedules you would use:
MLSchedule|Delete~Event 3
To disable the first event from the schedules you would use:
MLSchedule|Disable~0
To enable the fifth event from the schedules you would use:
MLSchedule|Enable~4
To execute right away the command associated with the event "Wake up" you would use:
MLSchedule|Exec~Wake up
To reset the event "Lights off" as if it had just been executed (mostly useful for "Fixed interval"), you would use:
MLSchedule|Reset~Lights off
To change the Last execution and recompute the Next execution, you would use:
MLSchedule|SetLastExecution~Lights off~<Date and Time>
Date and Time syntax example for US English PCs: 2/16/2008 11:15:12 PM Date and Time syntax example for French Canadian PCs: 16/02/2008 23:15:12
Other examples:
2008-05-01T07:34:42-5:00 2008-05-01 7:34:42Z Thu, 01 May 2008 07:34:42 GMT
To update the calendar's variables:
MLSchedule|UpdateCalendar
To add a certain number of months and update the calendar's variables:
MLSchedule|AddMonth~<month>
To add a certain number of years and update the calendar's variables:
MLSchedule|AddYear~<year>
Adding a new event to the schedules or modifying the timing of an existing event is a more complex task. While a more "human readable" syntax might be implemented in the future, currently it relies on the position (0 based) of the associated drop down list in the settings. For the <MLCommand>, the ~ need to be trippled (i.e. MLCmd.SetvariableFast|myVar~~~value). In the following commands, simply replace "Add" by "Edit" to modify an existing item.
Fixed interval
MLSchedule|Add~<event>~0~<Interval>~<Frequency>~<MLCommand>
A negative interval will only execute the event once and will not save it to the database.
A great example is to use MLSchedule to replace MLServer's MLPause command. MLPause stops processing all other commands while the Pause is being waited on. MLSchedule doesn't have this limitation. For example, if your current command is:
Macro|MLGC100|SendIR~VCR~PowerOn!MLPause|2!MLGC100|SendIR~VCR~Play
In this example, one is sending to the MLGC100 plugin (an IR device) a Power on command, waiting for 2 seconds and then sending a Play.
With MLSchedule you would use:
Macro|MLGC100|SendIR~VCR~PowerOn!MLSchedule|Add~MLPause_replacement~0~-2~0~MLGC100|SendIR~VCR~Play
Same thing here...send the Power On command, then name a temporary scheduled event called "MLPause_replacement" defined as a fixed time type event (0), wait for 2 seconds (the negative means don't repeat this), with a frequency of "seconds" (0) Then execute the Play command.
Second example:
MLSchedule|Add~MLPause_replacement~0~-2~1~
Would mean wait for 2 minutes (defined by 1), and don't repeat this again (the negative). You can see with changing those settings you can devise all kinds of timing related functions. So, while that 2 minutes wait is being processed, MLServer continues to process other requests fluently. You will notice a more responsive system overall.
Third example:
If you need to do pause's sequentially, here is a technique to use:
Macro|SetVariable|MLPauseTest~1!MLSchedule|Add~MLPause_replacement~0~-2~0~SetVariable|MLPauseTest~~~2! MLSchedule|Add~MLPause_replacement2~0~-4~0~SetVariable|MLPauseTest~~~3! MLSchedule|Add~MLPause_replacement3~0~-6~0~SetVariable|MLPauseTest~~~4! MLSchedule|Add~MLPause_replacement4~0~-8~0~SetVariable|MLPauseTest~~~5! MLSchedule|Add~MLPause_replacement5~0~-10~0~SetVariable|MLPauseTest~~~6
What this does is setup multiple events to be processed with two seconds inbetween those events.
Fixed time
MLSchedule|Add~<event>~1~<Time>~<FixedFrequency>~<Day>~<Month>~<Year>~<MLCommand>
End of month
MLSchedule|Add~<event>~2~<Time>~<MLCommand> MLSchedule|Add~<event>~2~<Time>~<Minus>~<Interval>~<Frequency>~<MLCommand>
Server launch
MLSchedule|Add~<event>~3~<Time>~<MLCommand> MLSchedule|Add~<event>~3~<Time>~<Interval>~<Frequency>~<MLCommand>
Sunrise
MLSchedule|Add~<event>~4~<MLCommand> MLSchedule|Add~<event>~4~<Minus>~<Interval>~<Frequency>~<MLCommand>
Sunset
MLSchedule|Add~<event>~5~<MLCommand> MLSchedule|Add~<event>~5~<Minus>~<Interval>~<Frequency>~<MLCommand>
Where
<Time>: represents the number of 15 minutes slices since midnight
(i.e. 0 = 0:00, 1 = 0:15, 6 = 1:30, 48 = noon, etc.).
<FixedFrequency>: 0 = Once, 1 = daily, 2 = Sunday, 3 = Monday, 4 = Tuesday, 5 = Wednesday, 6 = Thursday, 7 = Friday, 8 = Saturday, 9 = Week days, 10 = Weekend, 11 = Weekly, 12 = monthly, 13 = yearly. <Day>: number from 0 to 30, representing the day (i.e. 1 to 31). <Month>: 0 = January, 1 = February, ... 11 = December. <Interval>: number from 0 to 59, representing 1 to 60 in units of <<Frequency>>. <Frequency>: 0 = second(s), 1 = minute(s), 2 = hour(s), 3 = day(s), 4 = week(s), 5 = month(s). <Minus>: 0 = add the offset, 1 = substract the offset.
UI Settings
The "UI Settings" tab makes it possible to configure the plugin's interface for each individual MainLobby clients. The Folder location is relative to the Content folder, as defined on the MainLobby client (typically C:\Program Files\Cinemar\Content\0019\1024x768). The default Navigation and PopUp layers can be adjusted to match the rest of your scenes.
In order to launch the initial scene, the following command should be issued:
MLSchedule|SetLocation~List
Each individual event can be disabled. The event's name should be unique. The command accepts any valid MLServer commands.
Calendar
A simple calendar can be viewed through the User's Interface. The left (right) arrow will show the previous (next) month, while the down (up) arrow will show the previous (next) year. The month and days make use of the regional settings (French version displayed).
Currently, the events are not displayed on it, nor is it possible to create an event by clicking a day. Extra functionality might be added later.
Bugs
Under some unknown condition, the events get duplicated on execution...
New Features
To do:
- Dispatching events to Windows Scheduler.
- Improve the calendar's functionality?
Version History
Version 1.1.2
- Fix: SetLastExecution was not parsing the right parameter.
Version 1.1.1
- Added the command SetLastExecution~<Date and Time>.
Version 1.0.0 to 1.1.0
- Fix: Disabled events could not be restarted.
- Fix: Save was actually adding a new scheduled event.
- Changed the database updates and added an Event class.
- Moved the Logger part out of the invoke...
- Converted the "Fixed interval Once" into "Fixed time" events.
- Fix for the "once" schedule.
- Merged the Items and Schedule tab.
- Replaced the menu by adding an "About" button to the events tab.
- Added the possibility of clearing the log.
- The event log will be slightly less verbose unless "Verbose log" is enabled.
- No longer redraw the whole Schedule listview just to update one item.
- Fix: events were not added under some conditions.
Version 0.1.0 to 0.2.1
- Bug fixes.
- Improved the handling of event creation/modification.
- Fix: The Edit option from the Schedule was sending to the wrong tab.
- Renamed "Settings" to "UI Settings" and moved it to the third tab.
- Fix: the "Save as new" item was not always visible.
- Fix: events disabled at launch time could not really be enabled after.
- Removed some unnecessary database updates.
- Fix: there was a nasty bug duplicating database entries after execution.
- Only save the updated database every 30 seconds for Fixed interval events with a small delay (i.e. 1 sec).
- It is now possible to browse different months/years in the calendar view.
- Added the commands MLSchedule|UpdateCalendar, MLSchedule|AddMonth~{{month}}, MLSchedule|AddYear~{{year}}.
- Commands sent from ML Client/Server were bypassing some updates.
- It is now possible to Edit or Add Events from the User Interface.
- Added a simple calendar for the current month (no event displayed).
- Now properly reloads the navigation layer.
- Added basic navigation to the MainLobby UI.
- Replaced the "New item" check box by an "Add as new" button.
- Introduced the support for multiple clients. Renamed the plugin to MLSchedule.
- Added a default MainLobby client interface to consult the list of events.
- Added MLSchedules|Edit~<parameters>.
- Added the MLSchedules|<command>~<parameters>, where the <command> is chosen among {add|delete|disable|enable|exec|reset}.
Version 0.0.1 to 0.0.9
- Added a context menu to the list of Schedules.
- The path is no longer read from the registry. "Fixed time" is now working.
- "Sunrise" and "Sunset" are now working.
- "MLServer launch" is now working. Modifying an existing event's name was not sticking.
- "End of month" is now working. Enabling a disabled item will reset its "last execution".
- "Fixed interval" is now working.
- Added an extra combobox. Moved "Once" to "Fixed time". Added "End of month".
- Added the database access.
- Proof of concept. Initial settings.









