Ynote Script is the Scripting System embedded in Ynote Classic to extend it's functionality. This was achieved using the CSScript Library.
YnoteScript is just C#. It is revolving around the IYnote object. It can use all the .NET Framework Classes, Libraries and external libraries too. For eg, to add an external library, add this to the first line of the file -
//css_reference {yourlibrary}.dll;
The library should be located in Ynote's Root Directory. For more information see here.
Ynote Classic uses two core libraries -
Ynote Script is based on the CSScript Library, see the CSScript site for scripting guidelines.
Ynote finds and executes the Main Method which has the IYnote object.
static
void Main(IYnote ynote)
{
// code
}
IYnote wraps the basic functionality of Ynote Classic. It's contents are
FastColoredTextBox - See All The Methods of FastColoredTextBox which is the core of Ynote Classic.
DockPanelSuite - The Docking Library. Get Info of Ynote's ActiveDocument etc.
Ynote's Source Code - Best Reference Site. See the code of all objects
Ynote Samples - Some Scripting Samples
Example 1 :Below is a simple Hello Ynote script -
using SS.Ynote.Classic.UI;
static void Main(IYnote ynote)
{
// Define edit as the ActiveTab which is of type Editor
var edit = ynote.Panel.ActiveDocument as Editor;
// Insert Text in Tb (TextBox)
edit.Tb.InsertText("Hello, Ynote!");
}
The above script first Defines "edit" as the ActiveDocument of Ynote's DockPanel ("Panel") and casts it to Editor (The form which hosts the FastColoredTextBox denoted by Tb).
It Asks edit's Tb(FastColoredTextBox) to insert the text - "Hello, Ynote!" into the textArea.
Example 2 : Syntax Highlight
edit.Highlighter.HighlightSyntax(Language.Javascript, new TextChangedEventArgs(edit.Tb);
The above line of code when added to Example 1, will highlight the Javascript code on the ActiveDocument.
Highlighter -> ISyntaxHighlighter Interface