Doing a Command by Time Interval

If you want a function to be done by a time interval, do the following.
1. Create a server project with Timer command.
2. Create a cliet project on the basis of a server project.
3. Create graphical items.
4. Next:

  • 1. Drag a command to a graphical item
  • 2. Select Send Number
  • 3. Input value in seconds.Image 8995
5. Open JS window and write timer logics.


function SecondsStart(in_Type, in_Name, in_Value)
{
    IR.Log("Value = "+in_Value);
    var mstosec = in_Value*1000;
    IR.SetInterval(mstosec, SecondsFin)
}
function SecondsFin()
{
    IR.Log("Do it command")
}



6. Then fill in script field in a server project. Select SecondStart function as the one to be done for the command.Image 8996



7. Update server driver in a panel project
Image 8997Image 8998



Next upload the server project onto your server with the help of Transfer. Then connect a panel project to the server and work.



To work with Delay, do the same steps described above. But write the following logics:


function startdelay()
{
    IR.Log("Start command delay");
    IR.SetTimeOut(5000, enddelay)
}
function enddelay()
{
    IR.Log("End command delay")
}


1. Create a command on the server
2. Enter startdelay function iт the script field of a command.
3. Update a driver in a panel project.
4. Drag a command onto a graphic item.
5. Test the work.



To study deeper download the project.Timer.rar





This article was helpful for 3 people. Is this article helpful for you?