You are on page 1of 14

MiriServer documentation

V1.7.0, written by Steffen Schirmer

Startup Parameters General parameters File names as parameter The Interfaces (Win)LIRC-Interface What is (Win)LIRC? General Ifrared Receiver Hardware Self building receiver General WinLirc Purchasable receiver Ir2Pc IRMan Hardware for a button-cicuit For 15 buttons For 7 buttons and a rotary pulse encoder TCP-IP-Interface General stuff MiriServer answers Examples Command-Reference MoveMouse ClickMouse SetMousePos SwitchProfile ExitWindows SimulateKeyStroke SimulateKeyStroke_Down SimulateKeyStroke_UP ExecuteFile ExecutePluginFunction ExecuteMacro PlayScreenMacro CDRom ScreenSaver Volume SendJaLCDsCommand Sleep Repeat ShowScreenMessage Variables-Reference Table Examples

2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 5 5 5 6 6 7 7 8 8 9 9 9 10 10 10 10 11 11 11 11 12 12 12 13 13 13 13 14 14 14

Startup

Parameters
You can startup MiriServer with several parameters. Startup parameters are not case sensitive.

General parameters
/NoSplash No splash screen will be shown during startup. /Sleep MiriServer will wait 10 seconds until it finally starts up. This is needed to avoid problems with the COM-Port at Windows startup. You can edit the parameters in the properties of the MiriServer-Shortcut, or if you start Miriam automatically on Windows start, with the program Regedit at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\MiriServerStart.

File names as parameter


If one of the parameters is a filename MiriServer will try to open these file. MiriServer is able to open following file-types: *.mPLG *.mMAC *.mREC MiriServer Plugins (will open with the PluginEditor) MiriServer Macros (will open with the MacroEditor) MiriServer ScreenMacros (will open with the ScreenMacroRecorder)

The Interfaces
(Win)LIRC-Interface
What is (Win)LIRC?
WinLIRC allows you to transmit and receive standard infrared remote control signals. This allows you to control your computer using almost any standard infrared remote control. It also allows your computer to control other equipment which uses these signals (stereo equipment). WinLIRC is the Windows equivalent of LIRC, the Linux Infrared Remote Control program. WinLIRC (through version 0.6) was originally written by Jim Paris. Later releases are written and maintained on sourceforge.net.

General
MiriServer is able to connect itself to a (Win)LIRC-Server. In this case (Win)LIRC will take care of handling the infrared receiver and will send all the received stuff to MiriServer. Have a look at the (Win)LIRC-Website (and the pretty good documentation) at: http://winlirc.sourceforge.net. The advantage to use (Win)LIRC to handle the receiver in comparison to MiriServer is that (Win)LIRC is sometimes much better in receiving, decoding and interpreting signals from a simple receiver than MiriServer.

Ifrared Receiver Hardware


Self building receiver General
(no content yet)

WinLirc
(no content yet)

Purchasable receiver Ir2Pc


(no content yet)

IRMan
(no content yet)

Hardware for a button-cicuit


For 15 buttons

For 7 buttons and a rotary pulse encoder

TCP-IP-Interface
General stuff
The TCP-IP-Interface can be used to send commands to MiriServer. External programs can execute functions and commands in MiriServer. For a list of available commands, take a look at the commands reference. The interface is useful for remote administration via telnet-client, but it can also be used by programs to send data (even over a LAN) to MiriServer. Using this, anyone can develop own clients which can use the huge functionality of MiriServer. If you enable the internal TCP-IP-Server in the configuration dialog, then there will be one open port for communication. The port number and number of maximum connections can also be changed in the configuration dialog. If the connection was established successfully MiriServer answers and sends a list of available functions to the client. Then it waits for input. This input can be sent character by character or as a whole line. In any case it has to end with CrLf (meaning ASCII 13 & 10). MiriServer will answer on any full line with a statuscode consisting of three digits and a text message, eventually followed by additional data (e.g. the function-list or the active profile). The three digits in front of the statuscode can be easily processed in external programs (the same concept is used by the FTP-protocol). MiriServer also sometimes sends information to all connected clients. One event that causes this is the change of the available functions or active profile. Another event is on exiting MiriServer, so if the user closes the program, MiriServer sends a terminate to all connected clients.

MiriServer answers

010 020 030 055

Okay Ready Success Greetings

100 110 120 130 140

Information (general) Information about active profile A Hint from MiriServer (e.g. a description of an executed function) Information about the Server-Version Information terminate

200 210

Start of something (general) Start of sending function-list (will end with 020 Ready)

600 610 620 630 666 677

Error (general) Error (something unknown/miss-typed) Error (something is missing/does not exists) Error (Failed to interpret/convert) Error (general fail, fail to do something, however which matter) Error (no access / access denied)

Examples
There is a code-example for a working client included in the MiriServer installation. Take a look at the directory: %MiriServerDirectory%\src\. The code is written in Object Pacal (Borland Delphi [5]).

Command-Reference
This reference contains the supported commands of MiriServer V1.0.0. Later versions may support even more commands, please check the version history on http://sixdots.de/miriserver. Usually a commands syntax is as follows: CommandName ( param_1, param_2, ..., param_n ) ;

Name of Command

Brackets for the parameters

Parameters of the Command

Brackets for the parameters

Semicolon that define the end of the command.

The commands and its parameters usually are not case sensitive. Parameters can (but dont have to) be locked by quotations and have to be separated by commas. A Space character will be ignored.

MoveMouse
(Move mouse over the screen.) Syntax: Parameters: MoveMouse(direction, steps); direction: Moving direction. Can be: X+ XY+ YOptional numerical value. Number of pixels about the mouse cursor will be moved. Default is 10.

steps

Example:

MoveMouse(x+, 20); MoveMouse(y-, 43);

ClickMouse
(Simulates a mouse click) Syntax: Parameters: ClickMouse(button, clicktype); button The mouse button. Can be: Left Middle Right The way of clicking the button. Can be: Up Down Click

clicktype

Example:

ClickMouse(Left, Click); ClickMouse(Right, Down); ClickMouse(Right, Up);

SetMousePos
(Set the mouse cursor to a specified X,Y-postion on the screen) Syntax: Parameters: Example: SetMousePos(x, y); X y Numerical value of the horizontal pixel position on the screen. Numerical value of the vertical pixel position on the screen.

SetMousePos(20, 50);

SwitchProfile
(Switch to a specified or to the next Profile in MiriServer) Syntax: Parameters: Special info: SwitchProfile(profilename); profilename Text value. Name of profile, MiriServer should be switch to.

If parameter is left blank, MiriServer will switch to the next profile.

ExitWindows
(Exit, shutdown, logoff, suspend or reboot Windows) Syntax: Parameters: ExitWindows(exittype, delaycount); exittype The way of shutting down Windows. Can be: Shutdown Reboot LogOff PowerOff Force Standby Hibernate Optional numerical value that stands for the count of executions that will be needed until something will happen. Is needed to protect the function "ExitWindows();".

delaycount

Example:

ExitWindows(Shutdown); ExitWindows(Reboot); ExitWindows(Standby); ExitWindows(Shutdown, 8); ExitWindows(Reboot, 10);

SimulateKeyStroke
(Simulate a global keystroke) Syntax: Parameters: SimulateKeyStroke(key_1, key_2, key_3, ..., key_n); keys List of keys that should be simulated. The number of parameters depends on the number of keys to simulate. The parameters are virtual key codes. A list of all key codes can be found on the internet. Virtual key codes like A or C are also possible.

Example:

SimulateKeyStroke(A); SimulateKeyStroke(VK_F1); SimulateKeyStroke(VK_CONTROL, VK_ESCAPE); SimulateKeyStroke(VK_MENU, VK_F4); SimulateKeyStroke(VK_CONTROL, VK_MENU, VK_DEL);

SimulateKeyStroke_Down
Like SimulateKeyStroke, but only simulates key DOWN..

SimulateKeyStroke_UP
Like SimulateKeyStroke, but only simulates key UP.

ExecuteFile
(Execute a specified file or application) Syntax: Parameters: Example: ExecuteFile(filename, param); filename param Name of the file that should be executed. Optional parameter for the execute-parameter.

ExecuteFile(C:\program files\notepad.exe, d:\test.txt); ExecuteFile(C:\program files\winamp\winamp.exe);

ExecutePluginFunction
(Execute a function from a MiriServer-Plugin) Syntax: Parameters: Example: ExecutePluginFunction(pluginfilname, pluginfunction); pluginfilename pluginfunction Filename of the MiriServer-Plugin. Name of the plugin-function that should be executed.

ExecutePluginFunction(%PLUGINDIR%\Winamp.mPLG, Next); ExecutePluginFunction(%PLUGINDIR%\Winamp.mPLG, Stop); ExecutePluginFunction(D:\MyPlayer.mPLG, Start Playing);

ExecuteMacro
(Execute a MiriServer-Macro) Syntax: Parameters: Example: ExecuteMacro(macrofilename); macrofilename Filename of the MiriServer-Macro that should be executed.

ExecuteMacro(%MACRODIR%\test.mMAC); ExecuteMacro(D:\MyMacroTestDir\IncredibleFunction.mMAC);

PlayScreenMacro
(Play back a MiriServer-ScreenMacro) Syntax: Parameters: Example: PlayScreenMacro(filename); filename Filename of the MiriServer-ScreenMacro that should be played.

PlayScreenMacro(%SCREENMACRODIR%\test.mREC); PlayScreenMacro(D:\MyRecording\TestRecording.mMAC);

CDRom
(Open or close the default or a specified CD-Rom-Drive) Syntax: Parameters: CDRom(action, driveletter); action CD-Rom action. Can be: Open Close Optional parameter. Letter of drive that should be opened or closed. If left blank, MiriServer will take the default CD-Rom-Drive.

driveletter Example:

CDRom(Open); CDRom(Close); CDRom(Open, F); CDRom(Close, F);

ScreenSaver
(Activate or deactivate the Windows-Screensaver) Syntax: Parameters: ScreenSaver(action); action Screensaver-action. Can be: activate deactivate

Example:

ScreenSaver(activate); ScreenSaver(deactivate);

Volume
(Set Windows-Volume, mute it or turn it up, down) Syntax: Parameters: Volume(action, percent); action Volume action. Can be: Up Down Set Mute Unmute MuteUnMute Numerical value (in percent: 0..100). This parameter is partially optional.

percent Example:

Volume(Set, 0); Volume(Set, 50); Volume(Down); Volume(Up); Volume(Down, 10); Volume(Up, 30); Volume(Mute); Volume(UnMute); Volume(MuteUnmute);

SendJaLCDsCommand
(Connect to a JaLCDs-Server and send a specified command) Syntax: Parameters: SendJaLCDsCommand(host, port, command); host port command Example: Hostname of the JaLCDs-Server Port of the JaLCDs-Server. Normaly 10 possible ports; range 9825-9834. Text value. Command that should be send to the JaLCDs-Server. For more Information have a look at the JaLCDs-Documentation.

SendJaLCDsCommand(localhost, 9825, screen LCDScreen1); SendJaLCDsCommand(127.0.0.1, 9830, lcdoutput off);

Sleep
(Sleep for a while) Syntax: Parameters: Example: Sleep(milliseconds); milliseconds Sleep(6000); Sleep(500); Numerical value in milliseconds. 1000 milliseconds = 1 second.

Repeat
(Repeat the specified commands x-times) Syntax: Parameters: Repeat(count, listofcomands); count listofcommands Numerical value. Number of repeats. A list of MiriServer-Commands seperated by ;, which should be executed.

Example:

Repeat(12, Volume(down); Sleep(200););

ShowScreenMessage
(Shows a message in front of the screen.) Syntax: Parameters: ShowScreenMessage(text, seconds); text seconds Text that should be shown on the screen. Optional parameter. Duration, in seconds, of showing the message. If left blank, MiriServer will show the message 3 seconds.

Example:

ShowScreenMessage(%TIME%); ShowScreenMessage(%DATE%, 4); ShowScreenMessage(%TIME%#13#10%DATE%, 6); ShowScreenMessage(This is a test!, 2); ShowScreenMessage(Line1#13#10Line2);

Variables-Reference
There are some variables which you can use in MiriServer. Variables are case sensitive and usually in uppercase letters, locked by a percent sign.

Table
#13#10 Line break

%PLUGINDIR% %MACRODIR% %SCREENMACRODIR% %PROGRAMDIR%

Plugin-Directory Macro-Directory Screenmacro-Directory Application-Directory

%TIME% %DATE% %COMPUTERNAME%

Current time Current date Name of the computer.

%WINDOWCAPTION% %HANDLECAPTION% %WINAMPTITLE% %MORETVPROGRAMNUMBER% %MORETVPROGRAMNAME%

Caption of program-window. (only in Plugins) Caption directly from given handle (only in Plugins) Currently playing title from Winamp Current program-number of MoreTV Current program-name of MoreTV

Examples
ExecutePluginFunction(%PLUGINDIR%\Winamp.mPLG, Next);

You might also like