Service Scripts

Service scripts (or Script Plugins) is a rich kind of scripts, that are very close in possibilities to binary plugins and allows you to create extensions for HippoEDIT that seamlessly integrating into its UI giving the same feeling as native built-in functionality.

Such scripts are living resident in a HippoEDIT process and react on events (as menu command selection, shortcut call, or document load). Another feature of service scripts is automatic loading on every HippoEDIT start. So, you install it, and then it runs always until you uninstall it.

Installation here mean is simple running/execution of script using Tools→Execute… HippoEDIT automatically detects that script has been registered to one of events and keep plugin loaded (and reloads on start).
Un-install means unload it with Tools→Options→Plugins→your plugin name → uncheck.

Overwrite default syntax of new files

Set syntax dynamically all for new files (normally this is done with Tools→Options→Syntax Settings→Syntax→Miscellaneous→File Pattern)

onNewDocument = function() {
  this.Syntax = Settings.GetSyntax("xml");

Paste template with a button

The scripts: - register icon to be used on the toolbar - creates and registers command to be executed on button click or by shortcut - adds “enabled” callback to block execution if a document is read only - creates a toolbar and toolbar button and assigns the command to the button.

//${ region Icons }
var nIcon = Application.RegisterImageString(
//${ endregion }
var vCommand = new Command("MyTools.Paste", "Paste Template", "Paste my template", nIcon);
vCommand.onExecute = function() {
	var text = '<base href="file:///' + ActiveDocument.Path + '">';
 	ActiveDocument.InsertText(ActiveView.Position, text);
vCommand.onEnabled = function() {
	return ActiveDocument !== null && ActiveDocument.ReadOnly !== true;
// Initialize Toolbar
Application.onInitToolbars = function() {
	var MyToolbar = this.GetToolBar("MyTools", true);
	MyToolbar.Name = "MyTools";