HikariSub
Automation

The Automation panel

See the loaded scripts and their macros, run them, give them shortcuts, and read the log of each run.

The Automation panel lists every loaded script with its macros. From it you load, reload and edit scripts, run macros, give them shortcuts, and read what each run wrote to its log. How loading and running work is in Running scripts.

Opening the panel

  • Automation › Show panel
  • View › Panels › Automation › Show
  • Shift+click a macro in the Automation menu, which opens the panel ready to record that macro's shortcut.

The panel opens where it was last in this layout, or else in the column to the right of the Grid (see Where a panel opens). Like any panel, you can drag it elsewhere or float it. It has no key of its own.

At the top, Scripts and Runs switch between the two views. Runs shows how many runs it keeps, such as Runs 4. Beside them are four buttons:

ButtonDoes
Load script…Loads a script for the current subtitle file, or reloads it if it is already a subtitle script
Refresh autoload scriptsReloads the autoload scripts and loads new ones
Rerun last macroRuns the last macro again, with its dialogs
Repeat last runRuns the last macro again with the same answers

The ⋯ button on the panel's tab has Load script… and Refresh autoload scripts too, and:

  • Shortcuts in Settings…, which opens File › Settings › Hotkeys on the macros' shortcuts.
  • Clear runs, which empties the Runs view.

Scripts

The Automation panel's Scripts view: the Filter macros field, the script Shell fixture under Subtitle scripts with the macro Prefix from dialog on Ctrl+Alt+P and Wait for cancel recording Ctrl+Alt+P with the note Already assigned to: Prefix from dialog, and under Autoload the ticked script Host fixture with its macros, one on Ctrl+S with the note Save also uses Ctrl+S and takes it, the ticked syntax-error.lua marked Failed to load with its error, and macro-1-edgeblur.lua unticked, muted and without Reload
Recording a shortcut that another macro already has. The last autoload script is turned off.

The scripts are in two sections, each of which folds:

  • Subtitle scripts: the scripts you loaded with Load script…, or that a subtitle file names. There is one list for the whole program, not one per file.
  • Autoload: the scripts loaded at start.

When the current file names scripts that are not loaded, a bar above them says "This file names scripts:" and their names, with "Loading a script runs its code." Hover it for the paths. Load loads them, after asking you first unless they're in a trusted folder.

Filter macros shows only the macros whose name matches what you type. Down moves from it into the list.

Script rows

Each script shows its name in bold; hover it for the script's description. Beside the name may be its state:

StateMeans
LoadingIts top level is running
RunningOne of its macros is running
Failed to loadThe script has an error. The row shows it, starting with the file name and line, such as myscript.lua:12: '=' expected near 'end'; Show full error shows all of it
StoppedIts process ended. Reload it to use it again; nothing is rerun by itself

Reload loads the script again from its file. The ⋯ button on the row also has:

  • Edit script, which opens the file in your script editor. The first time, or with Shift held, HikariSub asks which program to use, in Select a script editor.
  • Unload, which takes the script out of the list, and its macros out of the menu. The script's path stays in the header of a subtitle file that names it.

An autoload script has a box before its name, Load at start. Untick it to turn the script off: it unloads, and it stays off at the next start and on Refresh autoload scripts. Its name shows muted, without Reload. Tick the box to load it again. The box is greyed out while the script loads or one of its macros runs. Subtitle scripts have no box.

This is how to turn off a bundled script you don't use. Deleting its file doesn't work: a bundled file you delete comes back at the next start.

Macro rows

Under each script are its macros. To run one, press its Run button, double-click it, or select it and press Enter. Right-click a macro, or press the Menu key, for Run, Set shortcut… and Clear shortcut.

KeyDoes
Up, DownMove through the macros
EnterRun the macro
F2Record a shortcut for the macro
MenuOpen the macro's menu

Shortcuts

Each macro row shows its keys, or Add shortcut when it has none. To record one, click that button, press F2, or choose Set shortcut…. The button reads Press a shortcut:

  1. Press the keys, such as Ctrl+Alt+P. If another command has them, the row says "Already assigned to:" and its name.
  2. Press Enter to save, or Esc to cancel. Clicking elsewhere cancels too.

Saving keys that another command has asks first, in Reassign shortcut: Reassign moves the keys to the macro, and Cancel keeps them where they are. Keep both is offered when the other command's key works in another place, so both can have it.

Macro keys work everywhere in the program. A Global command with the same keys wins, and the macro's row warns, for example "Save also uses Ctrl+S and takes it."

These are the same shortcuts that File › Settings › Hotkeys lists under Automation shortcuts. See Hotkeys.

Shortcuts for missing macros

A shortcut is kept when its macro is not loaded. The section Shortcuts for missing macros, folded at first, lists each one with the reason:

  • No loaded script has this macro
  • Several loaded scripts have this file name
  • The script has no such macro
  • The script or its macro changed
  • Not a macro shortcut

Remove shortcut deletes it. A shortcut works again by itself once its script loads.

Runs

The Runs view listing four runs: Levels applied, Fail failed, Retime karaoke cancelled and selected, and Busy cancelled. Below, the log of Retime karaoke, shown up to warning with times: a warning, a line without a level, an error, and the outcome The macro was cancelled; nothing was changed.
The log of a cancelled run, up to warnings, with times.

Runs keeps the last 20 macro runs of the session, newest first. The run under way shows on the progress card; it joins the list when it ends. The card's Open in panel opens a run here.

Each run shows its macro, its script, its file and when it started, then how it ended: Applied, Applied, problems named, Cancelled or Failed. Then come how long it took and how many lines it logged.

Select a run to read its log below:

ControlDoes
LevelShows lines up to a level: Up to fatal, Up to error, Up to warning, Up to hint, Up to debug or All levels
FilterShows only lines containing the text. Esc clears it
Show timesShows when each line was written, from the start of the run
CopyCopies the lines shown
Save…Saves the lines shown to a .log or .txt file

Beside the filter, a count such as 4 of 6 gives the lines shown out of all. Lines without a level always show, and so do HikariSub's own lines, such as an error or how the run ended. Scripts' lines above File › Settings › Automation › Lua trace level, 3 at first, are not kept: raise it to 4 or 5 to see debug and trace lines under Up to debug and All levels.

A run keeps up to 10,000 lines. Runs are kept until you quit or choose Clear runs; nothing is written to disk unless you use Save….

On this page