Skip to content

# anyRemote

# Variable substitution

In Exec(), Make(var,...), Load(), Include() commands is it possible to use internal "variables". Several of them are predefined.

# Variables list

## $(Home)

User home directory ($HOME) will be substituted instead of $(Home):

    2=ExecAndSet(list,replace,Files in home,ls $(Home))

## $(Mode)

Current mode will be substituted instead of $(Mode):

    3=Make(mode,xmms);Exec(kdialog --msgbox "New mode is $(Mode)")

## $(CfgDir)

Directory with configuration files substituted instead of $(CfgDir).

In most cases it is /usr/share/anyremote/cfg-data. Actually it depends on --prefix value which was used at build time.

It is posible to override this by setting AR_CFGDIR environment value.

    3=ExecAndSet(list,replace,Cfg Files,ls -1 $(CfgDir))

## $(CallId)

[AT-mode only] Caller ID will be substituted (if determined) instead of $(CallId):

    (InCall)=Exec(kdialog --msgbox $(CallId))

## $(BtAddr)

[Server-mode only] $(BtAddr) variable will be substituted with bluetooth address of the phone after successful connection by java client.

If connection absent (or established not in Server mode through bluetooth) this variable will have empty value.

    (Connect)=Exec(kdialog --msgbox "Connected by $(BtAddr)")

## $(Bluez)

$(Bluez) variable will have value yes if anyRemote is compiled with Bluez support, or will have value no if anyRemote is compiled without Bluez support.

    (Init)=Exec(kdialog --msgbox "anyRemote compiled with Bluez - $(Bluez)")

## $(Xtest)

$(Xtest) variable will have value yes if anyRemote is compiled with XTest support, or will have value no if anyRemote is compiled without XTest support.

    (Init)=Exec(kdialog --msgbox "anyRemote compiled with XTest - $(Xtest)")

## $(MixerCard)

This variable is used in configuration files which are uses amixer utility to control sound volume.

$(MixerCard) variable will have default value 0. You can reset this variable to appropriate value if Your system have different sound card configuration.

    (Init)=Make(var,MixerCard,by_value,1)

The most simple way to do this is to use hook_* files. So, just add command

    Make(var,MixerCard,by_value,1)

to $HOME/.anyRemote/hook_init file.

Also, take a look at here

## $(MixerChannel)

This variable is used in configuration files which are uses amixer utility to control sound volume.

$(MixerChannel) variable will have default value Master. You can reset this variable to appropriate value if Your system have different sound card configuration.

    (Init)=Make(var,MixerChannel,by_value,PCM)

The most simple way to do this is to use hook_* files. So, just add command

    Make(var,MixerChannel,by_value,PCM)

to $HOME/.anyRemote/hook_init file.

Also, take a look at here

## Variables used to control internal behaviour of anyRemote

If You need to tune internal behaviour of anyRemote, then it is good idea to use these variable in (Init) event handler or in $HOME/.anyRemote/hook_init file.

## $(Device)

This variable allows to specify connect string.

The same can be done by specifying -s ... command line parameter.

$(Device) variable will have default value bluetooth:19 (which is used in Server mode, so You have to care about this parameter in AT mode)

If anyRemote works as server correct then value for Device could be:

- bluetooth:_channel_or just bluetooth (to choose first available channel).
- socket:_port_
- ilirc:/path/to/socket_file
- local:/dev/ircomm#
- stdin

If anyRemote works in AT mode then correct value for Device could be:

- rfcomm:XX:XX:XX:XX:XX:XX:Y
- /dev/ircomm#
- /dev/ttyACM#

where XX:XX:XX:XX:XX:XX is the bluetooth address of the phone and last Y is the channel number and where # is just a number

    (Init)=Make(var,Device,by_value,rfcomm:00:12:EE:32:20:2B:1)

## $(Logging)

Print or not to print logging info to the file $HOME/.anyRemote/anyremote.log.

$(Logging) variable can be set to false|true|debug and will have default value false.

Set it to debug for verbose logging.

The same can be done by specifying -log command line parameter.

    (Init)=Make(var,Logging,by_value,debug);

By default all logging information will be stored in $HOME/.anyRemote/anyremote.log file. This could be altered by setting AR_TMPDIR environment variable. If AR_TMPDIR environment variable is set then logging information will be printed to ${AR_TMPDIR}/anyremote.log.${USER}

## $(ServiceName)

[Server mode over bluetooth only] This variable is used specify SDP service name.

$(ServiceName) variable will have default value anyRemote

The same can be done by specifying -name ... command line parameter.

    (Init)=Make(var,ServiceName,by_value,myName);

## Variables used only in AT-mode

## $(AutoConnect)

[AT-mode only] This variable can be set to true or false and have default value false.

If value of this variable is true, then anyRemote will try to re-connect to phone automatically.

The same can be done by specifying -a command line parameter.

    (Init)=Make(var,AutoConnect,by_value,true)

## $(AutoRepeat)

[AT-mode only] This variable can be set to true or false and have default value false.

This variable is used to switch on/off auto repeat feature (as on PC keyboard - about 10 times per second). Useful for mouse and keyboard emulation.

    (Init)=Make(var,AutoRepeat,by_value,true)

## $(Baudrate)

[AT-mode only] Baudrate to use; default value is 19200

Possible values for Baudrate could be:

- 300
- 1200
- 2400
- 9600
- 19200
- 38400
- 57600
- 115200 (if supported)
- 230400 (if supported)

    (Init)=Make(var,Baudrate,by_value,9600);

## $(CharSet)

[AT-mode only] This variable will have default value 8859-1.

This variable allows to specify charset by AT+CSCS=... command.

    (Init)=Make(var,CharSet,by_value,8859-1)

## $(CmerOff)

[AT-mode only] This variable is used to tune AT+CMER=... command which exits phone from "echo" mode. In "echo" mode phone will send key codes of pressed buttons to anyRemote. This variable have no default value. If this variable is not set anyRemote will try to determine it automatically.

    (Init)=Make(var,CmerOff,by_value,AT+CMER=0,0,0,0,0)

## $(CmerOn)

[AT-mode only] Used when anyRemote is in AT-mode only.

This variable is used to tune AT+CMER=... command which enters phone in "echo" mode. In "echo" mode phone will send key codes of pressed buttons to anyRemote. This variable have no default value. If this variable is not set anyRemote will try to determine it automatically.

    (Init)=Make(var,CmerOn,by_value,AT+CMER=3,2,0,0,0)

## $(TwoWayComm)

[AT-mode only] Send or don't send any commands (SendCKPD(), etc.) to the phone. Can be set as true or false. Default value is false.

    (Init)=Make(var,TwoWayComm,by_value,true)

## $(RetrySeconds)

[AT-mode only] Duration in seconds beetween attempts to reconnect to the phone in case if connection fails. Default value is 60. Works in conjunction with AutoConnect parameter.

    (Init)=Make(var,RetrySeconds,by_value,120);

## $(ToMainMenu)

[AT-mode only] CKPD sequence which used to reach main screen of the phone from any of phone's menus. For example, on Motorola-V500 to press "Red Cancel" button is enough to get out from any menu.

If set, that sequence will be sent to phone after each key press. Default value is empty string. This parameter is a kind of shortcut which allows not to specify SendCKPD(E) command for each Key_Code.

    (Init)=Make(var,ToMainMenu,by_value,E);

## Variables used only in iViewer mode

## $(IViewer)

[iViewer mode only] This variable can be set to true or false and have default value false.

If value of this variable is true, then anyRemote will use it as a hint to optimize handling of iViewer heartbeat messages.

    (Init)=Make(var,IViewer,by_value,true)

## Parametrized replies

[Server-mode only] There are $(Param) and $(Index) variables defined in handling command issued from java client menus. Use $$ inside braces to specify parametrized commands.

    Choose($$)=Exec(xmmsctrl track $(Index));\
               Exec(kdialog --msgbox "Selected track is $(Param)")

## User-defined variables

In addition to the predefined internal variables it is possible to define custom internal variables with Make(var,....) command.

    5=Make(var,my_variable,by_value,3.141526);
    5=Make(var,now_is,echo "Now is "`date`);

Maintained by anyRemote. Website by m.lettner.