Konversation comes with some handy scripts you can run from the program. To run a script, in a channel, query, DCC, or server tab, type a command of the form

/exec script [parameters]

which executes the script named script passing it (optional) parameters.

For example, type the following command in a channel tab

/exec kdeversion

to send your KDE and Qt™ version numbers to the channel.

/exec cmd uname -a

executes the cmd script, passing it uname -a. This sends your Linux® version string to the channel.

To learn more about the scripts installed with Konversation please see the Script Reference Guide

To get a list of all available scripts, type the following command in a Konsole screen.

ls `kde4-config --install data`konversation/scripts

You can write your own scripts. Scripts are shell scripts and can be written in any shell language, such as bash, perl, or python. When Konversation runs a script, the first two parameters sent to the script are:

  • The address of the server.

  • The channel name.

Here is a sample shell script (cmd).


# Executes a command and prints the output into Konversation.


$@ | while read line; do qdbus org.kde.konversation /irc say $SERVER "$TARGET" "$@: $line"; done

Notice that the script uses qdbus to communicate with Konversation. The say command causes the output to be sent to the channel as a normal message. To display something in the tab without sending it to other users, use info instead. Look at the existing script files for more examples of writing scripts.

To be able to run a script you have written, you must install it by copying it to `kde4-config --install data`konversation/scripts or to `kde4-config --localprefix`share/apps/konversation/scripts. You must also give the file execute privilege, for example chmod a+x myscript.