Automation 4

From Aegisub Wiki

Jump to: navigation, search

Automation 4 is the next generation of scripting for Aegisub. Apart from export filters like Automation 3, it also supports macros which are called directly from the Aegisub main UI, and manipulate the subtitles directly. Macros can even pop up dialog boxes!

Planned is also the ability for scripts to read and write other subtitle formats, infinitely extending the list of subtitle formats Aegisub can read and write.

Automation 4 exists in current pre-release versions of Aegisub 2.00 and is mostly working, though some parts are still missing.

While Automation 4 is defined with Lua (version 5.1) in mind, and the specs are written with Lua syntax, the implementation is designed so supporting additional scripting languages should also be possible. Importantly, Automation 3 scripts are still supported through a second scripting engine behaving as Automation 3.

Current specs/docs for Automation 4 (link to SVN repository)


[edit] Pitfalls and warnings

  • Don't start writing major scripts yet. While things shouldn't change much any longer, there's still a risk of some interfaces changing in a way that might break scripts.
  • Even though the os and io libraries are made available to scripts, use them sparingly and ideally not at all. Several of the functions in the os library can change the way Aegisub behaves even outside the execution of Automation scripts and should not be used at all.
  • Remember that all strings are UTF-8. If you need to handle them, use the unicode.lua include which contains several utility functions to handle UTF-8 text. Lua's built-in regex library assumes text is in the current non-Unicode locale and can break on UTF-8 text if you use character classes. (For example, the %s class that matches spaces can sometimes match a byte used in encoding some hiragana characters in UTF-8.)
Personal tools