Skip to content

# anyRemote

# Emulate(...) command

This command used to emulate keyboard and mouse events.

## Format description

    Emulate([_emulation_command_[,_params_]]....)

Several examples:

    0=Emulate(key,1)
    1=Emulate(mouse,3)
    2=Emulate(mousedown,1,mousermove,100,100,mouseup,1)
    3=Emulate(keydown,Control_L,key,c,keyup,Control_L)
    4=Emulate(keydown,by_value,0xffe3,key,by_value,0x0063,keyup,0xffe3)

Emulation command can be the following:

key, _key_ | emulate press and release button _key_ on keyboard
key, by_value, _key_value_ | emulate press and release _key_value_ on keyboard
keyup, _key_ | emulate only release of button _key_ on keyboard
keyup, by_value, _key_value_ | emulate only release _key_value_ on keyboard
keydown, _key_ | emulate only press of button _key_ on keyboard
keydown, by_value, _key_value_ | emulate only release _key_value_ on keyboard
mouse, _button_ | emulate press and release of mouse button _button_ (1,2,3...)
mouseup, _button_ | emulate only release of mouse button _button_ (1,2,3...)
mousedown, _button_ | emulate only press of mouse button _button_ (1,2,3...)
mousedblclick | emulate double click by left mouse button
mousemove,_x_,_y_ | emulate mouse moving to coordinates (_x_,_y_)
mousermove,_x_,_y_ | emulate mouse moving form current location by coordinates (_x_,_y_)
sleep,_msec_ | sleeps _msec_ microseconds before processing next emulation command

In single Emulate(...) command it is possible to use several emulation command:

    3=Emulate(keydown,Control_L,key,c,keyup,Control_L)

Symbolic values for keys to emulate could be obtained from /usr/X11/include/X11/keysymdef.h file. It needs to discard XK_ prefix from keysym definition to use it in Emulate(...) command.

In addition to this, it is possible to use the following symbolic values (from /usr/X11/include/X11/XF86keysym.h):

- AudioForward
- AudioLowerVolume
- AudioMute
- AudioNext
- AudioPause
- AudioPlay
- AudioPrev
- AudioRaiseVolume
- AudioRewind
- Back
- Close
- Eject
- Forward
- MonBrightnessDown
- MonBrightnessUp
- PowerOff
- WakeUp

Numeric values for keys to emulate could be obtained from /usr/X11/include/X11/keysymdef.h and /usr/X11/include/X11/XF86keysym.h files. They can be specified in decimal (like 32) or hexadecimal (like 0x00FF) form.

Mouse buttons (1-3) are numbered from left to right.

If You have some problems with handling "Shifted" keys like numbersign(#), please try to use

    0=Emulate(keydown,Shift_L);Emulate(key,numbersign);Emulate(keyup,Shift_L);

instead of just

    0=Emulate(key,numbersign)

Maintained by anyRemote. Website by m.lettner.