Decription & purpose

Autorun - is simple “content” plugin for manage some actions while starting Total Commander. At first this is was the personal project, that was made for merge different autorun tasks into single interface. Now it's developing mainly for making portable version simple. It's cover the most of startup requirements. For more advanced or specific actions is more reasonable run the script or create plugin in traditional language.

This plugin is a simple command processor that executes commands from text configuration file. All commands executes in the separate thread and should not freeze TC in case of problem in one of commands. It's possible to use variables and simple If..Else expression.

Autorun should work on any OS from Win2000 to Win8, but currently tested only on WinXP SP3 and Win7 x64.


Installation

Before installing plugin recommend to rename autorun.example.cfg file into autorun.cfg, and edit it if needed. Installation of plugin is usual for content plugins. Next, in order to load plugin at Total Commander start, you should create the fictitious color scheme:

  • On the “Color” page press “Define colors by file type…” button.
  • In the “Define colors by file type” dialog set cursor in any place in the list, and press “Add…” button.
  • Press “Define…” button.
  • In the “Define selection” dialog move to “Plugins” tab.
  • Select in “Plugin” dropdown list “autorun”.
  • Select in “Property” dropdown list “Autorun” (there will not be more properties).
  • Select in “OP” dropdown list ”=” and set in following field any integer, for example 1.
  • Press “Save” button, give the template some name , for example “Autorun”.
  • Next, repeatedly press OK button in all dialogs until options dialog will be closed.
  • Restart TC.

If you have many color schemes, it's recommended to move Autorun scheme to the top of list, else it can not run sometimes.

Plugin can be renamed, in this case change the name of configuration file correspondingly.


Configuration file

Configuration file is plain text file, either ANSI or UTF-16 (LE).

Plugin operate two sections in configuration file. First section executing when TC starting, second - when it finishing. Exit section begins after directive:

Pragma AutorunFinalizeSection


Basics

In the Autorun actions are performed by command. Every command in the Autorun placed on one line. The command may include the required parameters, optional parameters and switches. The order is regulated as follows: command, switches, required parameters, optional parameters.

All switches must begin with ”/” and be in front of any parameters. Switches are designed to change the behavior of command. All switches - optional.

In this help the mandatory parameters are enclosed in angle brackets: <parameter>. If the parameter is optional, it is additionally enclosed in square brackets: [<parameter>]. Since all the switches are optional, they are also enclosed in square brackets: [/A].

If the command returns a value, the variable in which result will be written is always placed first in the list of parameters (but after the options).

A line starting with # are treated as comments and ignored. Blank lines are ignored.

All parameters and switches separated by a space. If the parameter should contain a space, the parameter must be enclosed in quotes - double or single. In this case quotes of other type can be used in the parameter text. For example:

"param with spaces"
'param with spaces'
"param with spaces and 'quotes'"
'param with spaces and "quotes"'

Если нужно использовать в тексте кавычки обоих типов, то кавычки того типа, с которых начинается параметр, в тексте должны быть задвоены.

Пример:

"this ""text"" and this 'text' with quotes"
'this "text" and this ''text'' with quotes'


Directives

Directives are performed during the pre-processing script and results are valid during all time of the script executing. Directive begins with the “Pragma” keyword.

Pragma AutorunFinalizeSection

The script after this directive is processed at the Total Commander closing stage. If the directive is not used, no actions performed at the Total Commander closing stage.

Pragma AutorunBlockUnload

Blocks unloading plugin (using cm_UnloadPlugins) until closing Total Commander. Useful for ShellExec with /T switch. If the directive is not used, the blocking disabled.

Pragma AutorunLanguage <ID>

Loads the custom language messages from file autorun.lng. If this directive is not used, the default language (English) used. Since all plugin messages - errors, it makes sense to use this directive only during debugging.

ID Two or three-character language identifier, that used in Total Commander language files. File autorun.lng should contain a section with the same name. If a section is not found, English will be used.

Pragma AutorunAllowWriteEnv

By default, commands that return values can only write the result to internal variables. This directive allows the entry into the existing environment variables.


Variables

Plugin operates with two types of variables - internal and environmental variables. The only difference between them is only that the internal variables are only visible in the plugin, and the environment variables are available for Total Commander and programs, that run from it.

In general, a variable name can only contain Latin letters, numbers, and the underscore “_”. Internal variables are set with Set command, and environment variables with SetEnv. When you use variables in the command, Autorun does not differentiate between them and can get their values from both, but writing from the commands is available only into internal variables (the obvious exception - SetEnv). However, this behavior can be changed by AutorunAllowWriteEnv directive.

When you use variables in the command follow a simple rule: if the value is reading (“expanding”), the variable must be wrapped around with percent ”%”. If the variable is writing (commands Set, SetEnv, and others), its name is written as is. Example:

Set MY_COMMANDER_PATH %COMMANDER_PATH%

In the above example, the environment variable COMMANDER_PATH will be read and then written to the variable MY_COMMANDER_PATH.

Predefined constants

Plugin have few predefined variables (constants):

%AUTORUN_TCHANDLE% | Total Commander window handle (for using in scripts).
%AUTORUN_TCPID% | Total Commander process ID (for using in scripts).
%AUTORUN_ISADMIN% | 1 if TC executed under admin, else 0.
%AUTORUN_TCARCH% | 32 or 64 - TotalCommander architecture, where plugin loaded.

You can not redefine these constants.

Additional constants with system information are available in the plugin SysInfo.

ERROR variable

Autorun has a special ERROR variable. It is usually zero, but some commands may set it to a different value in the case of non-fatal errors (see the documentation for the command). If you need this information, check the value of the variable immediately after the operation, as the following command can change the value of the variable.


Conditional

Here is one and only conditional statement:

If <expression 1> Then
  ...
ElseIf <expression 2> Then
  ...
Else
  ...
EndIf

For numeric comparison operator can be one of: =, <>, >, <, >=, ?. For string comparison only = and <> allowed, comparison is case insensitive. Allowed brackets and operators AND and OR. If both expressions are numeric, then numeric comparison used.

Variables are always expanding in the expressions. If you assume that variable value can conatin spaces, wrap expression in quotes. Example:

If ("%var_with_spaces%" = "value") Then

Also, some special functions can be used in comparison. In this case comparison limited to only one function.

If Function1 <parameters> Then
  ...
ElseIf Function2 <parameters> Then
  ...
Else
  ...
EndIf

It's allowed to use both expressions and function in one condition (but in different branches).


CommandExec

CommandExec [/CD[:T|S|TS]] <command/path1> [<path2>]

Execute user command em_* or set a paths in the panels.

Parameters

command/path1 | In case of executing TC's internal command, this parameter must be set to the name of a user command (usually prefixed with em_). If case of setting paths, this parameter must contain the first path.
path2 | If case of setting paths, this parameter must contain the second path.

Switches

[/CD] Setting this switch allow to set paths in the Total Commander panels. First and optional second parameters - paths for setting in panels. After parameter can be optional flags how to set paths:
T - open in new tab,
S - make first path as source, second as target, else left and right panels accordingly,
ST - combination of parameters.


IniDelete

IniDelete <ini> <section> [<key>]

Deleting key or section from given configuration file.

Parameters

ini | Name of ini-file. May contain variables and environment variables.
section | Section name in the ini-file.
key | Key name in the ini-file. If parameter is omitted, the whole section will be deleted. Use with care!

Switches

None.

Related

IniRead, IniWrite


IniRead

IniRead <var> <ini> <section> <key> [<default value>]

Read the value from given configuration file.

Parameters

var | Name of the variable that will receive the value.
ini | Name of the ini-file. May contain variables and environment variables.
section | Section name in the ini-file.
key | Key name in the ini-file.
default value | Text that will be written to the variable, if key is absent in the file. If omitted, empty value will be written.

Switches

None.

Related

IniDelete, IniWrite


IniWrite

IniWrite [/EV-] <ini> <section> <key> [<text>]

Writing value into given configuration file. If writing failed, command set ERROR variable to 1.

Parameters

ini | Name of the ini-file. May contain variables and environment variables.
section | Section name in the ini-file.
key | Key name in the ini-file.
text | Text that will be written in the given key. If omitted, empty value will be written.

Switches

/EV- Disables the use of environment variables in the text.

Related

IniDelete, IniRead


FileExist

FileExist <var> <file>
FileExist <file>

Function available for direct calling and using in conditional. When direct calling, first mandatory parameter should be variable name, which will receive 0 or 1, depending on function result.

Parameters

var | Name of the variable that will receive the value (when calling directly).
file | Thename File name, the existence of which will be checked. May contain variables and environment variables.

Switches

None.


LoadFont

LoadFont [/N] <font>

Command that loading selecting font. By default this font will be available in Total Commander process only and will be unloaded when TC is closed.

Parameters

font Name of font. May contain variables and environment variables.

Switches

/N Allow other applications to use this font. Note, that font become unavailable when TC is closed.

Remarks

Supported fonts:

  • .fnt - Raw bitmap font file.
  • .ttf - Raw TrueType file.
  • .ttc - East Asian Windows: TrueType font collection.
  • .fot - TrueType resource file.
  • .otf - PostScript OpenType font.
  • .mmm - Multiple master Type1 font resource file. It must be used with .pfm and .pfb files.
  • .pfb - Type 1 font bits file. It is used with a .pfm file.
  • .pfm - Type 1 font metrics file. It is used with a .pfb file.

For adding fonts separated to parts, they should be separated by “|”. For example, abcxxxxx.pfm|abcxxxxx.pfb.


LoadLibrary

LoadLibrary [/U] <dll> [<function>]

Command that loading a dynamic library or pligin.

Parameters

dll | Dynamic library name. May contain variables and environment variables. Also, paths can be relative to the path where configuration file placed.
function | Function that will be executed immediately after loading the library. Function should not have parameters and return a result.

Switches

/U dll will be unloaded immediately after loading and executing function (if set).

Remarks

Note, that under 64-bit version you can load 64-bit libraries and plugins only, under 32-bit varsion - correspondingly 32-bit libraries.

For simplicity plugin using and using single config file in different TC versions, for 64-bit verions implicit loading used (similarly to TC plugins). For that 64-bit version of plugin should have “dll64” extension. In configuration “dll” extension using.

Example (on MoveButton): record in configuration “LoadLibrary Plugins\Autorun_MoveButton.dll”. Under 32-bit version will be loaded Autorun_MoveButton.dll, under 64-bit version - Autorun_MoveButton.dll64.


RegRead

RegRead [/HEX] [/I:xxx] <var> <key> [<param> [<default>]]

Read the registry value. Supported types: REG_DWORD, REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_BINARY (return hex-string). If you need to retieve default paramter, don't set parameter, or set it to empty in case you need to use default text.

Parameters

var | Name of the variable that will receive the value.
key | Registry key name. Can begins with full hive name (for example, HKEY_USERS), or with short (for example, HKU).
param | Parameter name. For retrieve “default” parameter, not set this or use empty value if you need default text.
default | Text that will be written to the variable, if registry reading error occured. If omitted, empty value will be written.

Switches

/HEX | Return REG_DWORD parameter as hex-string, else as decimal.
/I:xxx | String index (starting with 1) for REG_MULTI_SZ parameters. If not set, whole string return? separated by linebreaks.


RegWrite

RegWrite <key> <param> <type> <value> [<value2>..<valueN>]

Write the registry value. Supported types: REG_DWORD, REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_BINARY.

Parameters

key | Registry key name. Can begins with full hive name (for example, HKEY_USERS), or with short (for example, HKU).
param | Parameter name. For writing “default” parameter, use empty value.
type | Type of the value. Can be either REG_DWORD, REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_BINARY.
value | Value. If using REG_MULTI_SZ multiple values can be used.

Remarks

When writing with REG_BINARY type, value should be hex-string. In case of write error the %ERROR% variable will be set to 1.


RegDelete

RegDelete [/K] <key> [<param>]

Deletes the registry value or key.

Parameters

key | Registry key name. Can begins with full hive name (for example, HKEY_USERS), or with short (for example, HKU).
param | Parameter name. For delete “default” parameter, not set this or use empty value.

Switches

/K In case param is empty or omit, the whole key will be deleted.
Be careful when using this switch!

Remarks

In case of delete error the %ERROR% variable will be set to 1.


SendCommand

SendCommand <command>

Sends to TC it's internal command.

Parameters

command Can be literal (values retrieving from TOTALCMD.INC) or numeric.

Switches

None.


Set

Set [/C] | [/EV-] [/EE] <var> <text>

Sets internal variable. If variable doesn't exist, it will be created. If variable exist, but it constant, error will be show.

Parameters

var | Name of the variable.
text | Text of the variable. May contain another variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/EE | Enables the use escapes (\n, \r, \t) in the text.
/C | Treat text as expression with numeric result. Aritmetic operations and parenthesis are supported, variables (environment too) are always expanding.

Related

SetEnv


SetEnv

SetEnv [/A|/AD] [/EV-] [/EE] <var> <text>

Sets environment variable. Variable will be accesible only for current process and it's child processes.

If variable exists (inherited from parent process), command can change it, but changes will be accessible only for current process and it's child processes.

Parameters

var | Name of the variable.
text | Text of variable. May contain other variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/EE | Enables the use escapes (\n, \r, \t) in the text.
/А | Appends a text to exising variable text (replacing instead). See remarks.
/АD | The same as /A, but allow duplicating. See remarks.

Related

Set

Remarks

When using /A parameter, plugin is checking if text at the end of variable's text the same as text being added, and not adding it repeatedly. This allow to avoid the case when text is repeatedly adding when you restart TC or unload plugin by cm_UnloadPlugins. If you still need to add text without this check, use /AD.

Usage example (was actual for TC < 8.0): place “noclose.pif” in TC folder and add this path to the PATH variable for current process, after that Shift+Enter command will work correctly without placing this file to windows directory (portable mode).


ShellExec

ShellExec [/EV-] [/SW_HIDE|/SW_SHOWNORMAL|/SW_MINIMIZE|/SW_MAXIMIZE] [/T] [/W[:####]] [/WAIT[:####]] <file> [<params> [<workdir>]]

Executes the file. It can be executable, or arbitrary - in this case it will be opened in associated application.

If no params are set, but you need to set working directory, use empty string (two consecutive quotes).

Parameters

file | Name of the file. May contain variables and environment variables.
params | Parameters string. May contain variables and environment variables.
workdir | Name of the working directory. May contain variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/SW_HIDE | Executing as hidden.
/SW_SHOWNORMAL | Executing normally. Using when no explicit SW_* parameter set.
/SW_MINIMIZE | Executing minimized.
/SW_MAXIMIZE | Executing maximized.
/T | Terminate program when plugin unloading (also look AutorunBlockUnload directive.)
/TT | Terminate whole program tree when plugin unloading.
/W[:####] | Trying to close process window before program terminating. Default closing timeout 1000 ms. Parameter can have optional value that sets timeout, ex: /W:5000. This parameter can be used only with /T or /TT paramaters.
/WAIT[:####] | Waiting for process finish. By default waiting is infinite. After parameter can be optional value that sets timeout, ex: /WAIT:5000. When using this parameter /T or /TT paramaters are ignored.


Sleep

Sleep <delay>

Delay before executing next command in milliseconds.


StrLeft

StrLeft <var> <text> <count>

Write to variable the leftmost count characters of the string.


StrLen

StrLen  <var> <text>

Write to variable the text length.


StrLower

StrLower <var> <text>

Change text to lowercase and write result to variable.


StrMid

StrMid  <var> <text> <position> [<count>]

Extracts a number of characters from a text from given position. If count is omitted, then extracted characters till string end.


StrPos

StrPos [/S] <var> <text> <substr>

Write to variable the substring position in the string. If not found, zero returned.

Switches

/S Case-sensitive search.


StrReplace

StrReplace [/S]  <var> <text> <old substr> [<new substr>]

Write to variable text with old substrings replaced by new ones.

Switches

/S Case-sensitive search.


StrRight

StrRight <var> <text> <count>

Write to variable the rightmost count characters of the string.


StrTrim

StrTrim  <var> <text>

Write to variable the text with trimmed out leading and trailing whitespaces.


StrUpper

StrUpper <var> <text>

Change text to uppercase and write result to variable.


Standard plugins

If needed to use own commands with parameters, it's possible to use plugins. They are loading with LoadLibrary command.

Distributive already have few plugins.

MoveButton

Intended to moving the “Options” button in the copy/move dialogs of Total Commander (since it's new position starting from TC 7.50 don't liked by many people).

SysInfo

The plugin is designed to retrieve a variety of information from the system.

Process

The plugin includes additional functions for working with processes.


MoveOptionsButton

MoveOptionsButton <action>

Enable moving button.

Parameters

action Action can have the value:
MOVE_LEGACY - moving button to position as in versions prior 7.5.
MOVE_RIGHT - moving button to the right side of dialog.


Variables

Plugin exports the constants:

%SYSINFO_OSARCH% | The OS architecture where TC is running. This can be either 32 or 64.
%SYSINFO_OSVERSION% The ОС version where TC is running. This can be one of:
WIN_2000
WIN_XP
WIN_2003
WIN_2003R2
WIN_VISTA
WIN_2008
WIN_7
WIN_2008R2
WIN_8
WIN_2012

If version can not detected, returned the string:

"WIN_" + Major Version + "." + Minor Version

For workstation at the end of string “W” attached.

For example, for Windows 7 it's would be: WIN_6.2W, for Windows Server 2008 - WIN_6.1.

%SYSINFO_OSSERVICEPACK% | The service pack version (ex. Service Pack 3).
%SYSINFO_DESKTOPWIDTH% | Desktop width.
%SYSINFO_DESKTOPHEIGHT% | Desktop height.
%SYSINFO_DESKTOPDEPTH% | Desktop color depth.
%SYSINFO_USERLANG% | Three-chars user language code.


GetSysColor

GetSysColor <var> <color index>

Returns the value of the system color by specified index.

Параметры

var | Name of the variable that will receive the value.
color index | Numeric index of system color. Their values are available here. In case of passing unsupported value, will show an error message.


GetSystemMetrics

GetSystemMetrics <var> <metric index>

Returns the value of the system metric by specified index.

Parameters

var | Name of the variable that will receive the value.
metric index | Numeric index of metric. Their values are available here. In case of passing unsupported value, will show an error message.


SystemParametersInfo

SystemParametersInfo <var> <param index>

Returns the value of the system parameter by specified index.

Parameters

var | Name of the variable that will receive the value.
param index | Numeric index of system color. Their values are available here (look comments to the article). Not all indexes are supported, in case of passing unsupported value, will show an error message. Supported parameters see in table below.

Supported parameters

Parameter | Value
SPI_GETBORDER | 5
SPI_ICONHORIZONTALSPACING | 13
SPI_GETSCREENSAVETIMEOUT | 14
SPI_GETKEYBOARDDELAY | 22
SPI_ICONVERTICALSPACING | 24
SPI_GETMOUSESPEED | 112
SPI_GETMOUSEHOVERWIDTH | 98
SPI_GETMOUSEHOVERHEIGHT | 100
SPI_GETMOUSEHOVERTIME | 102
SPI_GETWHEELSCROLLLINES | 104
SPI_GETWHEELSCROLLCHARS | 108
SPI_GETFONTSMOOTHINGTYPE | 8202
SPI_GETFONTSMOOTHINGCONTRAST | 8204
SPI_GETFOCUSBORDERWIDTH | 8206
SPI_GETFOCUSBORDERHEIGHT | 8208
SPI_GETFONTSMOOTHINGORIENTATION | 8210
SPI_GETMESSAGEDURATION | 8214
SPI_GETKEYBOARDSPEED | 10
SPI_GETMENUSHOWDELAY | 106
SPI_GETFOREGROUNDLOCKTIMEOUT | 8192
SPI_GETACTIVEWNDTRKTIMEOUT | 8194
SPI_GETFOREGROUNDFLASHCOUNT | 8196
SPI_GETMOUSECLICKLOCKTIME | 8200
SPI_GETCARETWIDTH | 8198
SPI_GETMOUSETRAILS | 94
SPI_GETSCREENSAVEACTIVE | 16
SPI_GETICONTITLEWRAP | 25
SPI_GETMENUDROPALIGNMENT | 27
SPI_GETDRAGFULLWINDOWS | 38
SPI_GETKEYBOARDPREF | 68
SPI_GETSCREENREADER | 70
SPI_GETFONTSMOOTHING | 74
SPI_GETSHOWSOUNDS | 56
SPI_GETSNAPTODEFBUTTON | 95
SPI_GETSHOWIMEUI | 110
SPI_GETACTIVEWINDOWTRACKING | 4096
SPI_GETMENUANIMATION | 4098
SPI_GETCOMBOBOXANIMATION | 4100
SPI_GETLISTBOXSMOOTHSCROLLING | 4102
SPI_GETGRADIENTCAPTIONS | 4104
SPI_GETKEYBOARDCUES | 4106
SPI_GETACTIVEWNDTRKZORDER | 4108
SPI_GETHOTTRACKING | 4110
SPI_GETMENUFADE | 4114
SPI_GETSELECTIONFADE | 4116
SPI_GETTOOLTIPANIMATION | 4118
SPI_GETTOOLTIPFADE | 4120
SPI_GETCURSORSHADOW | 4122
SPI_GETMOUSESONAR | 4124
SPI_GETMOUSECLICKLOCK | 4126
SPI_GETMOUSEVANISH | 4128
SPI_GETFLATMENU | 4130
SPI_GETDROPSHADOW | 4132
SPI_GETBLOCKSENDINPUTRESETS | 4134
SPI_GETUIEFFECTS | 4158
SPI_GETDISABLEOVERLAPPEDCONTENT | 4160
SPI_GETCLIENTAREAANIMATION | 4162
SPI_GETCLEARTYPE | 4168
SPI_GETSCREENSAVESECURE | 118
SPI_GETBEEP | 1
SPI_GETDESKWALLPAPER | 115


Variables

Plugin exports the constants:

%PROCESS_USERISADMIN% | Can be either 0 or 1, if user is in the Administrators group.
%PROCESS_RUNASADMIN% | Can be either 0 or 1, if user is actually have the administrator righs.
%PROCESS_ISELEVATED% | Can be either 0 or 1, if process is executed with elevated privileges.
%PROCESS_INTEGRITYLEVEL% | Process integrity level. Can be either: 0 - Untrusted 1 - Low 2 - Medium 3 - High 4 - System


ProcessCount

ProcessCount [/F] [/EV-] <var> <process>

Returns the count of running processes.

Parameters

var | Name of the variable that will receive the value.
process | Process name. May contain variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/F | The search is performed using the full name of the process. The search is case-insensitive.

Related

ProcessExist


ProcessExecGetOutput

ProcessExecGetOutput [/EV-] [/OEM] <var> <file> [<parameters> [<path>]]

Starts a process (hidden) and gets its output through stdout to a variable. The file should only be executable.

Parameters

var | Name of the variable that will receive the value.
file | File name. May contain variables and environment variables.
parameters | File commandline. May contain variables and environment variables.
path | Working dir. May contain variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/OEM | Switch the progrem output encoding to OEM (ANSI by default).


ProcessExist

ProcessExist [/F] [/EV-] <var> <process>
ProcessExist [/F] [/EV-] <process>

Determines the presence of a running process.

The command is available for directly call and a call from the condition. When called directly, variable receive the value 0 or 1, in dependence of result.

Parameters

var | Name of the variable that will receive the value.
process | Process name. May contain variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/F | The search is performed using the full name of the process. The search is case-insensitive.

Related

ProcessCount


ProcessTerminate

ProcessTerminate [/F] [/EV-] [/TT] [/A] [/W[:####]] <process 1> [<process 2> [... <process N>]]

Closes one or more processes. Please note that the options apply to all processes listed in the command.

Parameters

var | Name of the variable that will receive the value.
process | Process name. May contain variables and environment variables.

Switches

/EV- | Disables the use of environment variables in the text.
/F | Use a comparison of the full path to the file.
/TT | Closes process tree, ie the process itself and all it's child processes.
/W[:xxxx] | Before closing processes, first tries to close the process's window. Standard completion timeout 1000 ms. After the option can optionally be present number specifying a timeout, for example: /W:5000.
/A | Close all processes with the given name (otherwise only the first).


For developers

When loading library with LoadLibrary, Autorun is trying to find Autorun_PluginInit function, if this is found, calling it allow developer to define custom commands and variables. Function get the AutorunInterface type structure with some useful information and pointer to adapter function. For working with functions it's need to assign this pointer to global variable Adapter. After that the next functions become available:

function AddFunc(AName: PWideChar; AAddr: Pointer; AFlags: integer): integer;

Adds user function for using in the Autorun script.

function ParseNext(AParamStr: PWideChar; ABuffer: PWideChar; ABufSize: DWORD): integer;

Returns the following parameters from the given string using the Autorun parser. Also this parameter is deleting from source string. Freeing the developer from doing this work. Function return the parameter type (AU_PARSER_NAMEDPARARAM, AU_PARSER_REGULARPARAM). If no more parameters, returns AU_PARSER_NOMOREPARAMS.

function GetVar(AVarName: PWideChar; ABuffer: PWideChar; nBufferSize: DWORD): integer;

Write into buffer ABuffer value of variable with AVarName name. If variable does not exist, function return error code AU_RESULT_VARNOEXIST.

function SetVar(const AName, AValue: PWideChar; AFlags: integer): integer;

Set variable with name AName and value AValue. If AFlags is have AU_VAR_CONSTANT set, variable will be protected from changes. If this function trying to change constant, it's value will be preserved, and function return error code AU_RESULT_NOREDEFINECONST.

function SetVarMacro(const AName: PWideChar; AFuncAddr: Pointer): integer;

Set variable with name AName and the function address AFuncAddr. When variable reading, callback function executing and return value.

function ExpandVars(const AText: PWideChar; ABuffer: PWideChar; ABufSize: DWORD): integer;

Expanding variables from given string AText to buffer ABuffer.

function ReportError(MsgID: integer; const AParam: PWideChar): integer; overload;

Show the standard error message (ID - in Autorun language file). If message require parameter, set it in AParam.

function ReportError(const AParam: PWideChar): integer; overload;

Show the non-standard error message

Look more in the header files, placed in the archive with test plugin source.


???????

Функции

GetSystemMetrics <переменная> <индекс метрики>

Возвращает значение системной метрики по заданному индексу.

Параметры

переменная | Имя переменной, в которое будет записано значение.
индекс метрики | Числовой индекс необходимой метрики. Их значения можно взять, например, здесь.

SystemParametersInfo <переменная> <индекс параметра>

Параметры

переменная | Имя переменной, в которое будет записано значение.
индекс параметра | Числовой индекс необходимого параметра. Их значения можно взять, например, здесь (см. комментарии к статье). Не все значения поддерживаются, в случае передачи неподдерживаемого значения будет выдано сообщение об ошибке.

GetSysColor <переменная> <индекс цвета>

Параметры

переменная | Имя переменной, в которое будет записано значение.
индекс цвета | Числовой индекс системного цвета. Их значения можно взять, например, здесь. В случае передачи неподдерживаемого значения будет выдано сообщение об ошибке.