# Scheduler Object The Scheduler object provides creating timed events. Members Table The following table lists the members provided by the Scheduler object.
Members
Methods | Description
AddDelayedEvent | Creates a delayed event.
AddFixedTimeEvent | Creates a fixed time event.
AddPeriodicEvent | Creates a periodic event.
RemoveEvent | Removes an event.
Remarks This object is available through the main object SiteKiosk. Use the Scheduler object to start events at a specified time. Note that the path of a file using SiteKiosk objects must be allowed in the SiteKiosk configuration (Security -> Access -> URL's With Script Permission) if it is not a browser skin file. Examples The following example shows the scheduler functionality.
    <html>
    <head>
    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();

    function sstartaction()
    {
       if (saction[0].checked) SiteKiosk.Quit();
       if (saction[1].checked) SiteKiosk.ShutdownWindows();
       if (saction[2].checked) SiteKiosk.RebootWindows();
       if (saction[3].checked) SiteKiosk.LogoffWindows();
    }
    function startscheduler()
    {
       myevtid = SiteKiosk.Scheduler.AddDelayedEvent(stime.value*1000,
       sstartaction);
       id_sas.innerHTML = "Status: Scheduler started";
    }
    </SCRIPT>
    </head>
    <body>
    <table border="0" bgcolor="#ebebeb" width="600" cellspacing="5"
    cellpadding="5" style="font-family:verdana;font-size:8pt;"
    align="center">
    <tr><td bgcolor="f8f8f8">
    When the link is clicked, the specified action will be
    started when the specified time elapsed. The scheduler
    can be used for various actions.
    </td></tr>
    <tr><td style="font-family:verdana;font-size:8pt;">
    <pre>
    <input type="radio" name="saction"> Quit SiteKiosk
    <input type="radio" name="saction" checked> Shutdown Windows
    <input type="radio" name="saction"> Reboot Windows
    <input type="radio" name="saction"> Logout Windows user
    <br>
    &nbsp;Time in seconds
    &nbsp;<select name="stime" size="1" style="width:150px;">
    <option value="5">5</option>
    <option value="10">10</option>
    <option value="15">15</option>
    </select>
    <br>
    <br>
    <span style="color:#cc3300;" id="id_sas">Status: inactive</span>
    </pre>
    </td></tr>
    </table>
    <br><br>
    <div align="center">
    <a href="javascript:startscheduler()">
    Activate
    </a>
    </div>
    </body>
    </html>
The following example can be modified and added to the "TrayWindow.html" of the used browser skin to achieve that SiteKiosk reboots or shuts down at an exact point of time.
    <script language="javascript">
    // Time:
    // use time in 24-hour format (HH:MM)
    // and "0" for no action.
    // Example:
    // sWeekDays[1] = "01:25"; // Time Mondays 1:25 a.m.
    // Action:
    // true=reboot, false=shutdown
    // Example:
    // bWeekReboot[1] = false;  // Shutdown Mondays

    var sWeekDays = new Array();
    var bWeekReboot = new Array();

    // Monday:
    sWeekDays[1] = "0";
    bWeekReboot[1] = true;

    // Tuesday
    sWeekDays[2] = "0";
    bWeekReboot[2] = true;

    // Wednesday
    sWeekDays[3] = "0";
    bWeekReboot[3] = true;

    // Thursday
    sWeekDays[4] = "0";
    bWeekReboot[4] = true;

    // Friday
    sWeekDays[5] = "0";
    bWeekReboot[5] = true;

    // Saturday
    sWeekDays[6] = "0";
    bWeekReboot[6] = true;

    // Sunday
    sWeekDays[7] = "0";
    bWeekReboot[7] = true;

    // Cutomizable Scheduler to reboot/shutdown this terminal
    function CreateShutdownScheduler()
    {
       var CurrentDate = new Date();
       var Day = CurrentDate.getDay();
       var strDays = new String();
       if (sWeekDays[Day] != "0")
       {
          strDays = sWeekDays[Day];
          if (bWeekReboot[Day])
          {
             SiteKiosk.Scheduler.AddFixedTimeEvent(
             parseInt(strDays.substring(0, 2)),
             parseInt(strDays.substring(3, 5)), 0,
             RebootScheduler);
          }else
          {
             SiteKiosk.Scheduler.AddFixedTimeEvent(
             parseInt(strDays.substring(0, 2)),
             parseInt(strDays.substring(3, 5)), 0,
             ShutdownScheduler);
          }
       }
    }

    // Customizable function to reboot
    function RebootScheduler(eventID)
    {
       SiteKiosk.RebootWindows();
    }

    // Customizable function to shutdown
    function ShutdownScheduler(eventID)
    {
       SiteKiosk.ShutdownWindows();
    }

    // Create Scheduler to shutdown/reboot the terminal
    CreateShutdownScheduler();
    </script>
Applies to SiteKiosk v5.0 (and later versions). Back to top