evaluator:applicable_contexts:functions:commands

The evaluator can be used to generate entire command lines. There are two types of command lines it can generate.

Executable commands

When the function is run, the return value from the evaluation expression will be executed as if it had always been part of the function.

To use this, simply begin the line with a = character, followed by the expression.

If the expression doesn't return a string to run as a command, the line is simply skipped over and execution moves on to the next line in the function. This lets you have functions that are composed of multiple evaluator command lines with a final command returned at the end.

Dynamic commands

In this mode, it can generate commands that are used to generate dynamic lists of buttons. For example, Go DRIVEBUTTONS is a dynamic button that generates a list of drive buttons.

This mode is accessed using the @ctx: modifier. The command returned by the expression will be used to generate dynamic buttons.

Variables

A number of variables are available to the evaluator in this context. Note that some are only applicable to toolbars in the standalone image viewer, and some only apply to Lister toolbars.

Variable Type Description

dest

path

The current destination path.

dest_shell

bool

True if the destination is a shell (virtual) folder hosted by Explorer, otherwise false.

expanded

uint

Returns the number of expanded directories.

fullscreen

bool

Viewer only. True if the viewer is fullscreen, otherwise false.

key_repeat

bool

True if the function was launched from a repeated key press (i.e. the key was held down).

seldirs

uint

Returns the number of selected directories.

selfiles

uint

Returns the number of selected files.

selimage

bool

Viewer only. True if an area of the image has been selected, false otherwise.

selitems

uint

Returns the total number of selected items.

source

path

The current source path.

source_shell

bool

True if the source is a shell (virtual) folder hosted by Explorer, otherwise false.

totaldirs

uint

Returns the total number of directories.

totalfiles

uint

Returns the total number of files.

totalitems

uint

Returns the total number of items.

viewmode

str

Returns the current view mode in the file display. Values are largeicons, smallicons, list, details, power, thumbnails and tiles.

As well as the above variables, you can also use evaluator functions like IsChecked and IsEnabled to query other information about the state of the Lister.

When generating executable commands, the evaluator can also access the values of the various external control codes as variables within the expression. For example, the current file path is available as the variable filepath.

The return value from the evaluation expression should be a str.

  • For executable commands, it will be executed as if it were a line of the function.
  • For dynamic commands, any dynamic buttons it generates will appear on the toolbar.