Chapter 2. Using KMessage
Keywords: KDE, kdeutils, KMessage, message

# Using KMessage

Prev |  | Next

## Chapter 2. Using KMessage

## Command line arguments

KMessage handles various command line arguments (including all the KDE and Qt command line arguments). The general syntax is:

`kmessage [ `-center` ] [ `-nearmouse` ] [ `-print` ] [ `-buttons` `buttons` ] [ `-default` `default` ][ `-file` ``file`` ] [ `-timeout` `timeout` ] `message``

`-center`

  Forces KMessage to position the window in the center of the screen.

`-nearmouse`

  Forces KMessage to position the upper-left corner of the window near the mouse pointer.

`-print`

  The name of the button that is clicked is written to standard output.

`-buttons` `buttons`

  Displays a row of buttons as specified in `buttons`. `buttons` should be a comma-separated list (without spaces!) of the names of the buttons. `buttons` defaults to okay.

  If `buttons` is specified the return value of KMessage will be 100+the number of the button pressed (counting from one). In the case that `buttons` is not specified explicitly on the command line the return value will be 0 (on normal exit).

`-default` `default`

  Gives keyboard focus to the button `default`. It is wise to give focus to the button that represents the safest choice.

`-file` ``file``

  Displays the contents of the file ``file``. If ``file`` is equal to - then input is read from standard input until a EOF is encountered.

`-timeout` `timeout`

  Displays the window only for `timeout` seconds.

To get all the available Qt and KDE command line options (such as setting the caption of the window) just type in:

`kmessage --help-all`