Creating Tool or Service Script

With scripting possibilities coming withing 1.50 release it is possible to automate a lot of routine task in advanced way (non advanced is using of macros, also available with 1.50).

HippoEDIT uses ActiveScripting and because of that supports any installed active scripting engine. By default supported JavaScript and VBScript. If you start any VBS or JS file inside of HippoEDIT with Execute command or as a tool, HE will assume that it is HE script and will try to execute passing scripting objects. So it can work with any *.js or *.vbs file. But for convenience, there are also dedicated schemes inherited from JS and VBS syntaxes and associated with *.hejs and *.hevbs extensions correspondingly. Dedicated schemes extended by HE specific syntax. Till now only HE JS schema is up to date. HE VBS will be updated later.

These resources can be used as starting point for learning scripting languages:

It is also possible to write scripts in other languages if they there is Active Script engine available

If you think about implementing something with scripting, you have two choices:

  • Tool script - script that executes and behaves as normal tool. It runs, does the work and exits.
  • Service script or, another name, Script Plugin - this is a rich version of scripts, similar to real binary plugins, which starts automatically, live in the background and react on such user interaction as a keystroke, menu or toolbar selection.

Scripting in HippoEDIT is not very different to any scripting implementation by other applications and very similar to scripts you can run in a web browser (like Internet Explorer, Firefox, Chrome etc). Any script for browser or other application which does not use internal objects exposed by the application itself (like window in browsers) should also run in HippoEDIT. All tricks with objects, inheritance, prototypes, accessing via this should also work.

There are some specialties, which implements HippoEDIT and which make it a little bit different (from functional but not conceptual side) from other scripting hosts (applications which allow scripting of them):

  • Of course, this is its own set of named objects exposed to script (as Application)
  • Support of including and importing of other script files (this is rather rare feature)
  • Emulating of WSH (Window Scripting Host) objects, to make it easier migration from WSH to HippoEDIT or even to run WSH scripts directly in HippoEDIT. Emulation works well on basic feature level, but some stuff is not supported
  • Events concept. This one of most powerful HippoEDIT features, which is similar to dynamic events in web browsers
  • Support of native dialog descriptions and data bindings
  • “Scoped” serialization support (global, workspace, project, session)

But independently to reach scripting feature set, HippoEDIT provides, writing of scripts is easy. Here is your first hello world application:

var version_string = "I am running HippoEDIT " + Application.version;
alert("Hello World!\r\n" + version_string );

Copy+Paste the code to new JavaScript document and try with Tools→Execute.

For easy start with your new script plugin, you can use Service Script Wizard from Scripting Tools plugin