Getting started with Program interface

Author: Mark Fric

May 7th, 2015

Rating:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Program is an interface that allows you to call any functionality of the program or plugins from snippets, or another plugins, etc.

Program interface was created so that plugins and Snippets can call functions defined in another plugins or in the program library itself.
It is not possible to call some plugin function from another plugin or snippet directly – snippet doesn’t know what plugins are and how they work.

For example, you want to run Monte Carlo simulation in a snippet – but Monte Carlo feature is a plugin, it might not be even present in your installation, and snippet doesn’t have access to its source code, so it cannot create its classes and call its methods directly.

Luckily, you can use universal Program interface. It allows any plugin to register itself as a “program” and then receive calls from external modules that ask it to do something.

For example, you can call Monte Carlo from a snippet using simple:

Program.get(“MonteCarlo”).call(“run”, …settings…);

The get() method returns a program interface for “MonteCarlo” – if it exists. Then you can call “run” method of this interface, pass it some parameters and expect it to return some results.

< Previous: Introduction to ScripterNext: List of programs >

0 Comments
Inline Feedbacks
View all comments