Specials and Built-in Global Variables

Specials are functions that are processed by Kommander. You should be aware that until Kommander has a full parser all Kommander specials will be executed first and then the script will be executed. In most cases this is not a problem, but in a few it is.

@dcop(appId, object, function, arguments)

Make a DCOP call. @dcop(kmail, KMailIface, checkMail(), )


The DCOP id of the process. (kmdr-executor-@pid)


Launches the specified Kommander dialog. Dialog is sought in dialog directory and in current directory - in that order. This prepends the call to the executor and sets the default directory to the one the Kommander application is in. Parameters can be passed in the usual Unix way or you can pass named parameters like variable=value. You can then find passed parameters in the global pool. @global(variable) would return value.


Expands to the specified environment variable. @env(PWD) expands to $PWD. Remember that $ is part of the shell and shouldn't be used.


returns the output of executing the specified command. @exec(ls -l).

@execBegin ... @execEnd

same as @exec, but supports shebang and multiline scripts. This serves for various scripting languages either by declaring them or using a shebang.

  • @execBegin(php)

  • @execBegin#!/usr/bin/php

The first one uses the name of the PHP executable. Kommander searches PATH for php and if it is not found looks to see if it is registered with Kommander in a location outside of your path. If not it tells the user it cannot be found. The second examples uses the classic shebang which can have some benefits and also problems. If you have a beta copy of PHP5, for instance, in /usr/local/bin which would not be found because it would find on in /usr/bin this is useful. If, however, you distribute the dialog to someone who has PHP in /usr/local/bin only it will not be found with the shebang used. So using shebangs is cautioned and using the executable is recommended if you are sharing files.


expands to the value of the specified global variable.


Returns null. Now that Kommander checks for empty widgetText on execution this will prevent erroneous errors in the case of an unset state on a widget.


The PID of the parent process.


The PID of the process.

@readSetting(key, defaultValue)

reads a value from kommanderrc


the selected content in a widget that can show more than one value, like list widgets

@setGlobal(variable, value)

Sets the global variable to the specified value.


the content of a widget

@writeSetting(key, value)

write value to kommanderrc

Array Function Group


Returns an EOL-separated list of all values in the array. Can be used to walk through an array.


Returns an EOL-separated list of all keys in the array.

@Array.setValue(array, key, value)

Sets a key and value for an element of an array. If no array exists it is created.


Remove all elements from the array.


Return number of elements in the array.


Return the value associated with the given key.


Remove element with the given key from the array.


Add all elements in the string to the array. String should have key\tvalue\n format."


"Return all elements in the array in key\tvalue\n format."

File Function Group


Return content of the given file.


Write given string to a file.


Append given string to the end of a file.

String Function Group


Return number of chars in the string.


Check if the string contains given substring.


Return position of a substring in the string, or -1 if it isn't found.


This will have an optional integer start position for find next uses in Alpha 6.

@String.left(string, int)

Return first n chars of the string.

@String.right(string, int)

Return last n chars of the string.

@String.mid(string, int start, int end)

Return substring of the string, starting from given position.

@String.remove(string, substring)

Remove all occurences of a given substring.

@String.replace(string, substring find, substring replace)

Replace all occurences of a given substring with a given replacement.


Convert the string to uppercase.


Convert the string to lowercase.

@String.compare(string, string)

Compare two strings. Return 0 if they are equal, -1 if the first one is lower, 1 if the first one is higher


Check if string is empty.


Check if string is a valid number.

Built-in Globals

Built-in globals are accessed just like regular global variables with @global.


The directory the current dialog is in.


The name of the dialog