Skip to content

# anyRemote

# How to create simple configuration file

## Configuration file examples

You may find predefined configuration files in cfg-data directory. Firstly, take a look to the simple configuration file like cfg-data/Server-mode/template-player.cfg. After investigation of some configuration files You'll became more familiar with its format.

## How To

### Specify keys to handle

A short example, which:

- Shows popup message if button 1 pressed.
- Show "Hello" string in title field of anyRemote client if button 2 pressed. Valid in Server mode.
- Set current time to the status field of anyRemote client if button 3 pressed. Valid in Server mode.

    [Protocol]=Server
    1=Exec(kdialog --msgbox "Hello!")
    2=Set(title,"Hello!")
    3=ExecAndSet(status,date +"%M:%S")
    ...

Exec() command is the mostly used one. It is used to run specified command.

Set()/ExecAndSet() commands used to control look and behavour of the client, which is used in Server mode.

To make custom setup of the clients main window upon connection:

    (Connect)=\
        Set(icons,TheTitle,\
            1,vol_down,2,mute,3,vol_up,\
    	4,rewind,5,play,6,forward,\
    	7,prev,8,pause,9,next,\
            *,question,0,stop,#,quit);\
        Set(status,Connected now);\
        Set(title,Hello!);

As You can see it is possible to execute more than one command at once.

At the end, another "almost" real Server mode example which contols Amarok/KDE3 player:

    [Protocol]=Server
    % Run amarok when connected
    (Connect)=Exec(amarok);

    % Volume control
    1=Exec(dcop amarok player volumeDown)
    2=Exec(dcop amarok player mute)
    3=Exec(dcop amarok player volumeUp)

    % Play, rewind back and forward
    4=Exec(dcop amarok player seekRelative -10)
    5=Exec(dcop amarok player play);Set(title,Playing);
    6=Exec(dcop amarok player seekRelative 10)

    % Previous song, stop playback and next song
    7=Exec(dcop amarok player prev);
    8=Exec(dcop amarok player stop);Set(title,Stopped);
    9=Exec(dcop amarok player next);

    % Pause playback
    0=Exec(dcop amarok player pause);Set(title,Paused);
    [End]

Lines starting with % are considered as a comment.

### Notes

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

It is suggested to avoid explicit usage of other shells, like bash or ksh in configuration files. Please keep in mind that some embedded systems like OpenWrt does not contains such packages by default.

Maintained by anyRemote. Website by m.lettner.