Top | Previous | Next |
Advanced / runScript |
runScript(scriptFunction, [pollRate]) Runs a single line of Python code as an expression. If a poll rate is specified, the function will be run repeatedly at the poll rate. This is a very powerful way for you to add extensions to the expression language.
For example, one could write a project script module function called app.weather.getTempAt(zip) that queried a web service for the current temperature at a given zipcode, and then bind the value of a label to the return value of that function.
You could implement app.weather.getTempAt(zip) with this Python script: # This function would query Yahoo Weather for the temperature at yahooURL = "http://xml.weather.yahoo.com/forecastrss?p="
And then you could use this expression to bind a property value to the weather: runScript("app.weather.getTempAt('95818')", 15000) ... This would bind a property to the temperature in sunny Sacramento, CA, and would refresh itself every 15 seconds.
See also:
|