Extensions

AutoHotkey SciTE

Extensions [v3.0.04+]

SciTE4AutoHotkey's functionality and behaviour can be extended through the use of Extensions. Extensions are packages that contain setting files, Lua scripts and other files necessary in order to provide such functionality and behaviour. They are distributed as compressed packages (.s4x) that are decompressed when the extension is to be installed.

Managing Extensions

In order to manage your Extensions, right-click on the toolbar and select "Extensions > Extension Manager". The Extension Manager window will pop up.

  • You can check and uncheck each extension in order to enable/disable them.
  • "Install extension" allows you to install or upgrade an extension.
  • "Remove extension" allows you to remove one or more extensions.
  • "Create extension" allows you to create your own extension. See Developing Extensions for more details.
  • "Export extension" allows you to create an installable Extension package (.s4x) in order to distribute your extension. See Developing Extensions for more details.

In order to apply changes, close the window.

Developing Extensions

Extensions have an internal package name which is intended to be unique for all extensions. The name should be a valid file name and should not contain spaces. It is recommended that it be lowercase. The recommended way to name your extensions is: usr.author.extension_name.

Extensions are stored in the %SciTEProfileDir%\Extensions folder, each in its own subfolder (named after the internal package name). Each extension has a manifest.ini file which contains information about the extension:

  • [Extension] section (all entries mandatory):
    • Name: Specifies the name of the extension.
    • Author: Specifies the author of the extension.
    • Version: Specifies the version number. It should be lexicographically comparable (e.g. Semantic versioning).
  • [Behaviour] section (all entries optional):
    • Properties: Specifies a pipe (|) delimited list of property files (relative to the extension folder and without the .properties extension) to apply to SciTE.
    • LuaScript: Specifies the filename of the Lua script (relative to the extension folder) to load into SciTE.
    • Toolbar: Specifies the filename of a toolbar properties file (relative to the extension folder) containing toolbar buttons to show in the AutoHotkey Toolbar.
    • LanguageMenu: Specifies text to be added to the menu.language SciTE property. Can contain $(dereferences).
    • FileFilter: Specifies text to be added to both the open.filter and save.filter SciTE properties. Can contain $(dereferences).

The "Create extension" dialog allows you to easily start writing an extension; providing template code. When the manifest is changed, you need to make SciTE4AutoHotkey reload it by right-clicking on the toolbar then selecting "Extensions > Reload extensions".

Utilities Available in Extensions

Lua scripts

The following API is additionally available:

RegisterEvents(eventTable) -- Chains events specified by the table. See the Lua script template for more details.
CancelAutoComplete() -- Cancels the AutoComplete popup.
GetWord(pos)
GetCurWord()
getPrevLinePos()
isInTable(table, elem)
GetFilteredLine(lineN, style1, style2) -- Retrieves the text of the specified line that is not styled using the specified numbers.
FileExists(fileName)

g_SettingsDir -- Global variable, points to %SciTEProfileDir%\Settings.

SciTE properties

The following properties are additionally available:

  • extensions.dir - Path to %SciTEProfileDir%\Extensions.

Toolbar definition files

The following dereferences are additionally available:

  • %EXTDIR% - Path to the extension's folder.