Nilesoft Shell Pro GitHub

Functions

The functions and variables have unique titles described by fully qualified names that indicate a logical hierarchy.

Shell has a number of functions and variables built into it that are always available. They are listed here in alphabetical order.

indexof

Find the position of a menu item.

Syntax

indexof(pattern[, offset[, default position]])

Used as a pos value. Once Explorer's items are in the menu, the item goes at the first item whose title matches pattern, plus offset (0 = before it, 1 = right after it). Patterns separated with | are tried in order; a quoted one ('"WinRAR"') matches the whole title, in any case, with & ignored. When nothing matches, the item goes to the default position: 'top', 'middle', a number (the position in the menu, counting from 0; past the end means the end), else the end. Items with the same indexof() keep their order in the file.

item(title='Open in Zed' cmd='zed.exe' pos=indexof('"WinRAR"|"Open in new window"', 1, 'top'))
item(title='Open in Zed' cmd='zed.exe' pos=indexof('"WinRAR"', 1, 3))
if

Conditionally executes another statement.

Syntax

if(condition-expression)

if(condition-expression, true-expression)

if(condition-expression, true-expression, false-expression)
null

Returns a null value.

Syntax

null(expression)

length (len)

Returns length of string and array type

Syntax

length(expression)

quote

Returns text with a double quotation mark.

Syntax

quote(expression)
char

Returns the value of the numeric parameter to a character.

Syntax

char(numeric-expression)
var

Returns the value of the passed variable

Syntax

var(expression)
tohex

Converting the value of the passed numeric expression to hexadecimal string.

Syntax

tohex(numeric-expression)
equal

Returns true if the parameters passed are equal.

Syntax

equal(expression-1, expression-2)
not

Returns true if the parameters passed are not equal.

Syntax

not(expression-1, expression-2)
greater

Returns true if the first parameter is greater than the second parameter.

Syntax

greater(expression-1, expression-2)
less

Returns true if the first parameter is less than the second parameter.

Syntax

less(expression-1, expression-2)
shl

bitwise left shift.

Syntax

shl(shift-expression, additive-expression)
shr

bitwise right shift.

Syntax

shr(shift-expression, additive-expression)
run, exec, launch, cmd, shell

Start a program, open a file or a folder, from cmd= or any other place an expression runs when the item is clicked.

Syntax

run(file, arguments, verb, directory, show, wait)

Only file is needed; leave out the values you don't need from the end, or write null to skip one.

  • arguments: the text passed to the program.
  • verb: how to open it, such as 'open', 'runas' (as administrator), 'edit' or 'print'. With run, exec, launch and cmd, it is 'runas' when you write anything after the file and 'open' when you don't, as before. With shell, Windows picks the default.
  • directory: the folder the program starts in. Left out, it is the folder you right-clicked in.
  • show: how the window shows, one of the cmd visibility values, such as cmd.hidden.
  • wait: 1 waits for the program to close before the rest of the command runs, 0 doesn't wait. Left out, it waits unless the window is hidden.

The older forms still work: run(file, arguments, show) and shell(file, arguments, verb, show). A number where the verb or the directory goes is taken as show. shell gives back the program's exit code when it waited for it.

item(title='Notepad here' cmd=run('notepad.exe', null, 'open'))
item(title='Repair (admin)' cmd=run('cmd.exe', '/c sfc /scannow', 'runas', null, cmd.normal, 0))
item(title='Hidden script' cmd=run('cmd.exe', '/c echo hi > out.txt', 'open', sel.dir, cmd.hidden, 1))
cmd visibility enumerations

The flags that specify how an application is to be displayed when it is opened.

cmd.hidden
cmd.show
cmd.visible
cmd.normal
cmd.maximized
cmd.minimized
Selection mode enumerations

Syntax

mode.none
mode.single
mode.multiple
mode.multiunique
mode.multisingle
mode.multi
Selection type enumerations

Syntax

type.desktop
type.directory(dir)
type.drive
type.dvd (type.cd)
type.file
type.fixed
type.namespace
type.remote
type.unknown
type.usb
type.vhd
Keywords
null
bool
true
false
auto
none
default
app | color | image | io | key | msg | path | reg | sel | str | sys | user| input | ini | clipboard