Using shared scripts in ProntoScript

Unfortunately, ProntoScript does not directy support shared scripts that can be defined in one place and then used in several activities/pages.

But there is a workaround!

Create a widget (e.g. a panel) on a (hidden) page, put the shared code in the label of this widget and then eval’ the code from another page.

Example:

  • Create an activity “Shared” (remember to set the PS tag to “Shared”)
  • Create a page “ScriptLibs” (remember to set the PS tag to “ScriptLibs”)
  • Create a panel “MyLib” (remember to set the PS tag to “MyLib”)
  • Put the shared code in the label of “MyLib”

Then, in another activity/page, you can execute the shared code by using:


eval (CF.widget("MyLib", "ScriptLibs", "Shared").label);

Thans to GuerillaBuild/Jason for this information:

http://www.remotecentral.com/cgi-bin/mboard/prontopro/thread.cgi?2331,1#2

If you like my work, buy me a beer. (Suggested: 3€ for a beer, or more for more beer ;-) )

Tags:

Leave a Reply