ListLines

Enables or disables line logging or displays the script lines most recently executed.

ListLines Mode

Parameters

Mode

Type: Integer

If omitted, the history of lines most recently executed is shown. The first parameter affects only the behavior of the current thread as follows:

1 or True: Includes subsequently-executed lines in the history. This is the starting default for all scripts.

0 or False: Omits subsequently-executed lines from the history.

Return Value

Type: Integer

This function returns the previous setting.

Remarks

ListLines (with no parameter) is equivalent to selecting the "View->Lines most recently executed" menu item in the main window. It can help debug a script.

ListLines Mode can be used to selectively omit some lines from the history, which can help prevent the history from filling up too quickly (such as in a loop with many fast iterations). The line which called ListLines is also removed from the line history, to prevent clutter. Additionally, performance may be reduced by a few percent while line logging is enabled.

When the ListLines mode is changed, the current line (generally the one that called ListLines or assigned to A_ListLines) is omitted from the line history.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this function. That default may be changed by using this function during script startup.

The built-in variable A_ListLines contains 1 if ListLines is enabled and 0 otherwise.

On a related note, the built-in variables A_LineNumber and A_LineFile contain the currently executing line number and the file name to which it belongs.

KeyHistory, ListHotkeys, ListVars

Examples

Enables and disables line logging for specific lines and then displays the result.

x := "This line is logged"
ListLines False
x := "This line is not logged"
ListLines True
ListLines
MsgBox