The Snippets Tool

The Snippets tool allows you to paste in preformatted code that is generally required for SILVIA to execute any of its scripts, without taking up your system’s clipboard. Most SILVIA scripts are wrapped with a “public bool Invoke() {… return bool;}” type of method.

To prevent having to rewrite boilerplate code, use the “ Snippets” Menu at the bottom right of the Script Field. Click to select a code block and it will be pasted into the Script Field. This way, if there is other code to insert already in the clipboard, you can then immediately paste the rest of it, instead of switching applications or going elsewhere to copy text again. For example, below is a standard Validation block, uncommenting and editing the lines leading to “return false;” allows quick setup of a rejection condition.

rejection condition