GN4 is scriptable software, that allows you to change the behaviour and the look & feel of GN4 applications, without affecting the main programming core.
GN4 uses VB.Net as the scripting language. It provides direct control of scriptable GN4 applications. A scriptable application is one that can respond to a variety of actions and events by performing operations or supplying data. Moreover you can write scripts that automate operations with multiple GN4 applications.
You can use GN4 scripts to add new features to a GN4 application, to change the way an existing feature behaves, and to provide an automation of repetitive tasks or complex workflows.
GN4 scripts fully support Unicode text and 64-bit platforms, intensive math operations and lengthy text processing, user interface elements, events and native GN4 and VB.Net commands.
You perform an action by selecting an option in a menu, pressing a shortcut key, clicking a toolbar icon, rolling a mouse wheel, or clicking mouse button, dragging a selection, dragging a content from one place to another and so on. When you click an option in a menu, it runs the associated GN4 script in the appropriate GN4 add-in (for more details about add-ins, see Add-ins structure). Every action is linked to a GN4 script. The standard configuration contains several hundreds of GN4 scripts. Scripts, needed for the "standard" operations are associated to menus, shortcut keys and toolbar icons. Such standard configuration is optimized for typical newsroom needs. However, the standard configuration contains many scripts that are waiting for you to assign them to a menu command, key, or icon of your choice. How to do it, is explained in Configuring menus, Configuring keyboard and mouse shortcuts and Configuring toolbars. You can add new actions, or modify existing ones. |
When you open an article using the appropriate action (menu command, or double-click on a listing), an event is automatically fired. In this example, the event name is OnArticleOpen. The event itself is not assigned to any menu command, key or icon - it runs automatically. You cannot add new events, but you can modify existing ones. |
GN4 scripts are organized in add-ins. See Add-ins structure and other topics in this chapter for more information. GN4 scripts typically contains GN4 and VB.Net commands. GN4 scripts can be simple or rather complex. The simplest script contains just one command (see more below about commands). The complex scripts contain hundreds instruction lines. |
Scripts are containers for commands. Commands perform atomic operations, such as "move cursor left", "open an article", "link this to the page" and so on. GN4 commands are developed by our programmers, and made available in the GN4 software to be called from scripts. VB.Net commands are developed by Microsoft programmers, and they're available to be used in GN4 scripts. For the reference of GN4 commands see GN4 Programming Reference. Commands are "black-boxes" - you cannot change the way existing commands work. The list of commands is closed - you cannot add new commands, or rename them or remove them. But, you can combine several commands into a script, and provide automation or smart behaviour. You can add as many scripts as you want and vary them as often as you want. Scripts are also needed to assign commands to actions. Normally, you can assign a command to an action only through a script. It is not possible to call the command directly from a menu command, key, icon etc. |
When you want to change what an action does, you need to locate the action in the configuration file (see Configuring GN4 user interface), to locate the script it calls, and then replace the script it calls with another script. You can also modify the script itself, or create a new one. |
See also
Differences between GN4 and GN3 scripting
Converting GN3 code to GN4 code