Configuration file format: Server mode

Configuration file examples

You may find some predefined configuration files in cfg-data/Server-mode and cfg-data/Bemused-emulation directories. After investigation of these configuration files You became more familiar with its format.


Line starting with a % considered as a comment line.

%This is a comment

Long command can be splitted into the several lines. You have to put backslash (\) as the last character to continue a command to the next line.

1=Exec(echo "this is first line");\
Exec(echo "this is second line");

Parameters section

GuiAppName="application name"

GuiAppBinary="name of executable"|"command which returns name of executable"

GuiAppRun="command do determine is application running or not; must returns OK or NOK"

GuiAppIcon="icon name"



GuiAppDesc=Some text

These parameters is used by GUI frontends only.

GuiAppRun=echo 'A=`dcop | grep amarok`; if [ "x$A" == "x" ]; \
   then echo NOK; else echo OK; fi'|bash -f -s
GuiAppDesc=Application decription
One=Exec(echo "Hello world!");

[Protocol] section

A short example:


    Exec(kdialog --msgbox "Initialized");

    Exec(kdialog --msgbox "Connected")

    Exec(kdialog --msgbox "Disconnected")

1=Exec(kdialog --msgbox 1)
2=Exec(kdialog --msgbox 2)
3=Exec(kdialog --msgbox 3)
4=Exec(kdialog --msgbox 4)
5=Exec(kdialog --msgbox 5)




Where CommandX could be:

Exec() command

1=Exec(kdialog --msgbox 1)
2=Exec(kdialog --msgbox 2)

anyRemote uses popen system call in Exec() command. This means that command will be executed inside /bin/sh command interpreter.

It is possible to write quite complex commands inside Exec(), for example:

1=Exec(D=`dcop | grep digikam`;\
       if [ "x$D" = "x" ]; then \
           digikam & \
       else \
           dcop $D MainApplication-Interface quit;\

It is possible to define multi-key commands

3 1=Exec(kdialog --msgbox 3_1)
3 2=Exec(kdialog --msgbox 3_2)
3 3 1=Exec(kdialog --msgbox 3_3_1)

It is not good idea to define:

3 3=Exec(kdialog --msgbox 3_3)
3 3 1=Exec(kdialog --msgbox 3_3_1)

simultaneously, since only one command will works (which one - depends on search order).

It is possible to group keymappings in so-called "mode" to set more than one command to the key.

Modes supports inheritance - in example below mode child is inherited from modes parent1 and parent2.

0=Exec(kdialog --msgbox 0)
1=Exec(kdialog --msgbox 1)
2=Exec(kdialog --msgbox 2)

[Mode]=child  : parent1,parent2
1=Exec(kdialog --msgbox 1_in_Mode_2)
2=Exec(kdialog --msgbox 2_in_Mode_2)

3=Exec(kdialog --msgbox 3_in_Mode_p1)

4=Exec(kdialog --msgbox 4_in_Mode_p2)

If current mode is not default mode (see Make(mode ...); command), then firstly key will be searched in current mode and if not found then it will be searched in parent modes (if it exists) and then in default mode.

Note: As a result it needs to use (EnterMode) and (ExitMode) "events" very carefully in default mode.

Macro() command

This command used to create new keymapping:

Macro1=Exec(kdialog --msgbox 1);Exec(kdialog --msgbox 2)

Macro() command can contains condition:

0=Make(var,macro_test,echo "0");
2=Macro(Macro2, if [ -f /tmp/file_name ];\ 
                then true; else false; fi; echo $?)
Macro2=Exec(kdialog --msgbox "Condition is OK")

Conditional Macro() will be execute only if a result of variable substitution or execution of the command is equal to string "0".

Note: In shells result code of command execution stored in $? environment variable.

Set() command

These commands used to control and customize GUI of the client. See detailed description here.

It is possible to change:

Example of how the client can look like Example of how the client can look like

ExecAndSet() command

Format: ExecAndSet(tag,command)

This command similar to the Set(), but uses the output of command specified as a string to set GUI elements of the client specified in tag field. See detailed description here.

5=ExecAndSet(title,dcop amarok player nowPlaying);



Timer(key, timeout, maxTimes) or

Timer(key, cancel|pause|continue|reset|restart)

This command sets/removes a timer for the key specified. A command sequence, associated with this key will be executed periodically.

For example, the following commands run 'dcop amarok player nowPlaying' command 2 times with timeout equal to 5 sec and set result to the title field of the client:

1=Timer(TimerCmd, 5, 2)
TimerCmd=ExecAndSet(title, dcop amarok player nowPlaying)

The following command run 'date' command every 10 sec and set result to the status field of the client:

2=Timer(Timer2, 10, 0)
Timer2=ExecAndSet(status, date)

It is impossible to have two active timer commands with the same key.

To delete existing timer use the following command:


To reset timer use the following command:


To completely restart timer use the following command:


This command resets timer and resets counter of timer's executions

Also, see note about data caching.

Load() command

This command used to load commands from file and execute them:


Include() command

This command used to include definitions from external configuration file:


Definitions from included file will not rewrite any of existing definitions.

Send() command


Send(string, string_value) or

Send(byte, byte_value1, byte_value2,...)

Sends to the the client specified string or sequence of bytes. This command is used in Bemused server emulation.

1=Send(string, simple_string)

byte_valueX is string representation of 1 - 255 values. Send(byte, ...) command sends to the the client specified bytes of data, one by one. Mainly this command is used to Bemused server emulation.


ExecAndSend() command



This command similar to the Send(tag, ...), but uses the output of command specified as a string to send. So, it is possible to execute dynamically created command. This command is used in Bemused server emulation.

4=Exec(echo "Set(title,dynamic title)">/tmp/command.txt);\
  ExecAndSend(string,cat /tmp/command.txt)

Get() command


Get(screen_size|cover_size|icon_size|icon_padding|model|version|cursor|password|ping) or



This command used to retrieve from phone some information.


Get(screeen_size) used to get screen size of cell phone. As a response to this command two replies will be send: SizeX(width,) and SizeY(height,). SizeX(width,) reply will be the first one.

Get(cover_size) used to determine maximal size of cover image which can be shown by Set(cover, ...) command. As a response to this command one reply will be send: CoverSize(_size_,)

If client layout is not initialized or set to default or "3x4" then returned cover size can be set to -1

Get(icon_size) used to determine size of used icon set. As a response to this command one reply will be send: IconSize(_size_,). It is possible to change icon size with Set(parameter,icon_size,...) command.

Get(icon_padding) used to determine icon padding. As a response to this command one reply will be send: IconPadding(_size_,). It is possible to change icon padding with Set(parameter,icon_padding,...) command.

Get(model) used to get "microedition.platform" property of J2ME client. For many phones this property contains manufacturer and model number (like "SonyEricssonK750i/R1CA021" for SE-K750). As a response to this command Model(,_string_) reply will be sent.

Get(is_exists,...) used to determine was cover image or icon with given name and size uploaded to phone or not. As a response to this command IconExists(_size_,_icon_name_)/CoverExists(,_cover_name_) or IconNotExists(_size_,_icon_name_)/CoverNotExists(,_cover_name_) reply will be sent.

Note for Get(is_exists,cover...)command: If client layout is not initialized or set to default or "3x4" then returned reply can be CoverNotExists(,_cover_name_) despite of existense of cover.

Get(version) used to retrieve J2ME/Android client version. As a response to this command Version(,_version_) reply will be sent.

Get(cursor) user to determine cursor position on Image screen of J2ME client. Two replies PosX(x_coord,) and PosY(y_coord,) will be sent. PosX() event will be first one. If current screen of the client is not Image screen then no replies will be sent.

Get(ping) user to send "keepalive" messages to J2ME/Android client. As a response to this command Ping reply will be sent.

Get(password) user to ask password from J2ME/Android client. As a response to this command _PASSWORD_(,_password_) reply will be sent. This reply handled by anyRemote internally, so generally users should not worry about it.

Password should be stored in $HOME/.anyRemote/password file in a plain text.

End() command



This command used only if -s web:xxxx command line option is used. This commmand used internally and should not be used in configuration files. The purpose of the command is to inform build-in web server about fact what command sequence is fully processed

Make() command



This command used control local state of anyRemote.


See detailed description here.

Event handlers

There are several "events" could be triggered. See Event handlers page for details.

Variable substitution

In Exec(), Make(var,...), Load(), Include() commands is it possible to use internal "variables". See Variable substitution page for details.