Next: , Previous: Scripts, Up: Scripting GPS


16.8.2 Scripts and GPS actions

There is a strong relationship between GPS actions, as defined in the customization files (see Defining Actions), and scripting languages

Actions can be bound to menus and keys through the customization files or the Edit->Key shortcuts dialog.

These actions can execute any script command, See Defining Actions. This is done through the <shell> XML tag.

But the opposite is also true. From a script, you can execute any action registered in GPS. This can for instance be used to split windows, highlight lines in the editor, ... when no equivalent shell function exists. This can also be used to execute external commands, if the scripting language doesn't support this in an easy manner.

Such calls are made through a call to execute_action, as in the following example:

     execute_action "Split horizontally"
     GPS.execute_action (action="Split horizontally")

The list of actions known to GPS can be found through the Edit->Key shortcuts dialog. Action names are case sensitive.

Some of the shell commands take subprograms as parameters. If you are using the GPS shell, this means you have to pass the name of a GPS action. If you are using Python, this means that you pass a subprogram, See Subprogram parameters.