This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSS: how to create a javascript periodic timing or keyboard events?

Guru 19935 points

Hello,

Is it possible to create periodic timing events (i.e. calling a function periodically)  or keyboard events in CCS version of javascript?

Also, is it possible to query whether a key was pressed?

Stephen

  • Hi Stephen,

    Note that there is no "CCS version of javascript". The javascript shell used by CCS/DSS is standard Rhino and supports standard javascript.

    As for if javascript can support the actions you ask, I don't know off the top of my head. But googling around yielded some results

    http://stackoverflow.com/questions/1224463/is-there-any-way-to-call-a-function-periodically-in-javascript

    http://www.w3schools.com/jsref/event_onkeypress.asp

    http://dmauro.github.io/Keypress/

    Thanks

    ki

  • Hello Ki,

    I believe those links are for using javascript on a webpage and consequently, the examples don't work with dss.

    Stephen

  • DSS is just a bunch of Java APIs. As long as java APIs can be called by the script (even if executed from a webpage), then it is fine. Most examples out there on the web are in context of a webpage since that is the dominant environment for javascript. But in many cases will work outside a webpage environment too.

    Also if there is functionality missing from javascript, you may be able to do it via Java (file.io being a prime example). If I come across any examples, I'll let you know.

    Thanks

    ki