myServer Command Syntax

myServerCMD Syntax and Usage

Understanding the myServeCmd (myServer Command) is one of the most important aspects of using myServer.  This section is designed to help you obtain a better understanding of the myServer command line syntax and how to effectively use it.

myServeCmd’s can be used from within HTML web pages, myServer, and Plug-ins. The myServeCmd is how myServer sends and receives commands to other applications.

This section will guide you through a series of examples on proper usage of myServeCmds. They will gradually build in complexity, by the end of this section you should have a good understanding of the myServeCmd syntax and how it’s used within the suite of myServer products.

To make building commands even easier - myServer has the "Command Builder".  To use it, click on Command Builder button in myServer.  Select from the Command Class dropdown which device you want to interact with.  The Device Number or Alias dropdown should appear.  Select the appropriate one.  The Command list should appear that contains appropriate commands for that device.  Select from the list that applies to your situation.  You will see the Macro building in the box below.  You can also add {{}} braces around the command with a click of the Add{{}} button.

Once the command is built, you can immediately test it, copy to clipboard (to be pasted into a scene as example).  Easy way to build powerful capability into your system!  For more detailed understanding, read on...


Because there are so many possible variables that can be used (myWeather has over 7,000!) it's easier to go into the Server Variables button and filter the list to find the group of variables that are currently defined on your system.  Device driver variables all start with "<<familyname>>_<<deviceid>>_" to make it more uniform to find what is applicable.  Many variables are created when myServer launches and loads the driver or app.  Keep in mind that some variables only get created when an event occurs and the driver creates a new variable on that event.



Pipe "|": Always follows plugin name or Macro; Tilde "~": Seperates commands and parameters


Exclamation "!": Seperates plugin commands when used with Macro


myServer Command Line Special Characters

myServer uses several special characters within its command line syntax. The following table defines each of these symbols and provides an example of their usage.

myServer Command Line Symbol – Quick Reference Symbol Name Definition ! Exclamation An exclamation is used to separate commands in a macro.


Macro|SetVariable| <>~MLCallerID| <>!SetVariable| <>~MLCallerID| <>

Note the exclamation symbol used before the second SetVariable to separate the two SetVariable commands in the macro. | Pipe The pipe symbol is used to separate a plug-in name from the actual command.



Plug-in Command Arguments In this example the Pipe is used to separate the MLCallerID plug-in from the SendCID command.

. Period A period is used to separate the myServerCmd prefix from the actual plug-in name.



Plug-in Anytime a command it entered, it must precede ~ Tilde A tilde is used to separate arguments within a command.



Argument #1 Argument #2 In this example the tilde is used to separate the Name and Number argument when sending CallerID information. {{ }} Double Brackets Double brackets are used to place hold variable names or parameter names. To see a listing of available variables, click on View in Window under the Variables section in myServer.


To display a variable within a Button Label use the following syntax: {{Variable name}}

In this example we are pulling a dynamic variable from the XMLobby plug-in. Many of the myServer plug-ins have predefined dynamic variable that can be displayed in MainLobby. To view a list of available variables for each plug-in, simply select the plug-in within myServer and click on the Help option. <<>> Double Arrows Double surrounding arrows are used to signify variables local to the application/client instance.


They are used to signify the variables applicable to the selected DVD in DVD Lobby at the moment that a given client issues a command.


SetVariable| <>~MLCallerID| <> Double Pound

The double pound symbols are only used in conditionals to separate the argument from the actions to be performed.


(MLConditional|IsEqual##arg1##arg2##Command to execute if true##Command to execute if false)

myServer Command Examples In this section we will be adding a button to a MainLobby Scene that will communicate with myServer to perform several tasks.

The actual myServerCMD we will use in this example is:


We will breakdown the entire command line at the end of this example to provide you with a better understanding of how it works.

The following assumptions are being made for this example:

  • myServer is running on the same machine as MainLobby
  • myServer is started
  • The MainLobby client is connected to myServer

1. Let’s start this session by opening MainLobby and bringing up the Main Menu. This can be accomplished by moving the mouse to the top of the MainLobby interface or pressing the F9 key on your keyboard.

2. Click on New to create a new Scene.

3. Click on Design to enter Design Mode.

4. Click on Library to open up the Button Library.

5. Select button0001 one time to add it to the MainLobby Stage. Select OK and you should see the new button on the Stage.

6. Click Edit on the Main Menu.

7. Double-click on the button we just added. This will bring up the Button Properties Panel.

8. Locate the myServerCMD field and select the A button to the left of it. This will open the myServerCMD Panel (Figure 1.6). Figure 1.6 myServerCMD Panel

9. Click the drop-down arrow and select Macro from the list. IMPORTANT: When you select a command from the drop-down list, you will be presented with a command syntax example as well. In this case, the example is: Macro|MLFileOpen|notepad.exe!MLPause|3!MLWindowFunctions|Notepad~SENDKEYS~Hello As mentioned in the Glossary of Terms, a macro is defined as a saved sequence of commands or keyboard strokes that can be stored and then recalled with a single command or keyboard stroke. When you wish to embed a macro within a macro, since myServer parses the Macro by breaking everything at the ! delimiters, it does not know how to distinguish the inner Macro from the outer. The solution is to put the inner macro in its own command map and call that instead

10. Place your mouse pointer in the window and click once next to the Macro| text.

11. Finish the command by typing the following text: MLFileOpen|notepad.exe!MLPause|3!MLWindowFunctions|Notepad~SENDKEYS~Hello Note: Ensure there are no spaces in the command line syntax above.

12. Select OK to close the myServerCMD Panel. The myServerCMD field should now be populated with the command we just entered (Figure 1.7). Figure 1.7 myServerCMD

13. Select OK to close out the Button Properties Panel.

14. Select Launch in the Main Menu to enter Launch mode.

15. Click the button we created on the myDesigner stage. You should see the Windows Notepad load and after a three second delay, the text HELLO appears.

In the table below, we will breakdown each piece of myServerCMD used in this example.

myServer Command (Input)


Command Line Syntax Breakdown

 myServerCMD The myServerCMD is similar to a RUN statement. It is how all myServer commands are initiated and it is required for any action on the myServer command line. The period is used to separate the myServerCMD initiator from the actual plug-in name.

. The period symbol is used to separate the myServerCMD operator from the plug-in.

Macro The Macro plug-in allows you to build a sequence of commands on the command line.

| The pipe symbol is used to separate the plug-in from its command which happens to be MLFileOpen in this example.

MLFileOpen The MLFileOpen command allows myServer to launch any file.

| The pipe symbol is used again to separate the MLFileOpen plug-in from its command, which in this case happens to be an executable file. notepad.exe The Windows application we intend to launch.

! An exclamation symbol is then used to separate commands within a macro, in this example it separates the MLFileOpen command from the MLPause command.

MLPause The MLPause plug-in allows you to pause a macro for a user defined number of seconds. In this example, the macro pauses for 3 seconds.

| The pipe symbol is used again to separate the MLPause plug-in from its command.

3 The number of seconds used to pause the macro.

! An exclamation symbol is used again to separate the commands within the macro.

MLWindowFunctions The MLWindowFunctions plug-in allows you to control various aspects of the Windows environment. For a detailed description of what features you can control, see the end of this guide for a detailed listing of the plug-ins included with myServer.

| The pipe symbol is used again to separate the MLWindowFunctions plug-in from its command.

Notepad Notepad identifies the application used to perform the MLWindowFunctions on.

~ A tilde is used to separate the arguments within the command. SENDKEYS The SENDKEYS argument sets focus on the Notepad window and emulates keystrokes.

~ Again a tilde is used to separate the arguments within the command.

HELLO The text that is typed in Notepad.

This concludes example #1.

Example #2:

Description In this example we will walk through setting up and using the MLCallerID plug-in. The MLCallerID plug-in allows you to use a modem to display caller ID information and photos on MainLobby clients. The MLCallerID plug-in allows users to capture and display a callers name, phone number, time of call and display a picture of caller (if properly configured).

The myServerCMD we will use in this example will send CallerID Name and Number information to one or many MainLobby clients.

The following assumptions are being made for this example:

  • myServer is running on the same machine as MainLobby
  • myServer is started
  • The MainLobby client is connected to myServer (Figure 1.2)
  • A modem is installed in the computer running myServer and its CallerID capable.

IMPORTANT: This plug-In requires CallerID service from your local telecom service provider. Contact your service provider for additional details.

You must also have at least on caller ID name/number setup in the MLCallerID plug-in.

myServer Command (Input)


Command Line Syntax Breakdown

myServerCMD The myServerCMD is similar to a RUN statement. It is how all MainLobby Server commands are initiated and it is required for any action on the myServer command line. The period is used to separate the myServerCMD initiator from the actual plug-in name. myServer processes all server variable names as lowercase, regardless how they are typed.

. The period symbol is used to separate the myServerCMD operator from the plug-in. MLCallerID

MLCallerID is the physical name of the myServer CallerID plug-in. Command Line syntax for the MLCallerID plug-in: MLCallerID| <>

Supported commands:

• GET • CLEAR • SendCID:name~number | The pipe symbol is used to separate the plug-in from its command which happens to be SendCID in this example.

SendCID SendCID is a command of the MLCallerID plug-in. This command is used to send Name and Number CallerID information to MainLobby clients or third-party applications.

Name Name is an argument of the SendCID command. The MLCallerID plug-in interprets the incoming CallerID information and populates this variable automatically.

~ The tilde is used to separate each argument, in this case Name and Number.

Number Number is an argument of the SendCID command. The MLCallerID plug-in interprets the incoming CallerID information and populates this variable automatically.

SetVariable Creates a variable in myServer. SetVariable|VariableName~VariableValue

All variables created get sent to all clients and get sent to the myServer event processor that can then act on those changed variable values.

SetVariableFast Creates a variable in myServer. SetVariableFast|VariableName~VariableValue

All variables created get sent to all clients and DO NOT get sent to the myServer event processor. So, any variables created or updated using SetVariableFast cannot be used as a trigger for automation events. But, the variable gets created much faster for scene updates (as example).

Additional MLCallerID command examples

Example #1:MLCallerID|SendCID:Name~Number

Example #2: hs.plugin("MLHSPlugin").myServerCMD "MLCallerID|SendCID:" & cstr(CallName) & "~" & cstr(CallNMBR)

Example #3: Macro|SetVariable|<<LastCallerName>>~MLCallerID|<<NAME>>!SetVariable|<<LastCallerNumber>>~MLCallerID|<<NUMBER>>

Example #4: SetVariable|<<LastCallerName>>~MLCallerID|<<NAME>>

Formatting of Variables: myServer has a built in function called FormatVariable

Syntax is FormatVariable|Value~Variable~Type~Mask

Where Value = data to be formatted

Variable = name of server variable to hold formatted data

Type = Type of data in Value (must be one of DATE, NUMBER, STRING)

Mask = formatting mask

For example:

FormatVariable|{{Currentdate}}~mydate~date~dddd, mmm d yyyy

Will take the current value of the server variable currentdate and create a new variable called mydate.

If currentdate = 6/2/2006 then mydate = Saturday, Jun 3 2006

Here are some valid masks

DATE "h:m:s" Returns "17:4:23" "hh:mm:ss AMPM" Returns "05:04:23 PM" "dddd, mmm d yyyy" Returns "Wednesday, Jan 27 1993"

NUMBER "##,##0.00" Returns "5,459.40" "###0.00" Returns "334.90. "0.00%" Returns "500.00%"

STRING "LC" Returns "hello" "UC" Returns "HELLO"

All of the valid Format masks can be used.

URL Encoding URL Encoding is used by MainLobby client and Server when sending Server variables to clients. This resolves issue with adding in multi-line text fields. Requires MainLobby version 3.0.6 or higher. Displays client version number in clients window.

Time and Dates It is suggested that all sunrise / sunset event rules use the currentdate server variable as the reference variable. Set the update frequency to 60 seconds in MLDateTime. (If you need more frequent time updates then set the update frequency to the value you want)

Health and Status Report Access the report via the built in web server at http://servername:6246/ServerStatus.

Commonly used command examples:

Change Scene example: You can change scenes from any client or web browser, by sending:


You can also choose ALL for the client to tell all connected clients to open the scene



MLCmd examples (used to invoke actions on the MainLobby Client, instead of on the server):


MLCmd|MLCommand~[Client/All]~[MLCmd: MLBackScene/MLminimize/MLexit/MLsendtoback/RemoteFX Hide/RemoteFX Show/OverlayFX Hide/OverlayFX Show/BackgroundFX Hide/BackgroundFX Show/TaskBarShow/TaskBarHide/MLMenu]


MLCmd|MLCommand~ALL~MLExit MLCmd|MLCommand~server1~MLBackScene

MLCmd|MLCommand~server1~MLminimize (note this is case sensitive!)

MLCmd|MLCommand~HTPC1~MLminimize Note “MLmaximize” is not supported.

MLCmd| (must be run on the myServer that the client is pointed to)



To close client connections to myServer:


myServerConnection|connect~localhost~5004 ie: myServerConnection|connect~

PC Shutdown techniques

Commands to shutdown myServer PC: MLSShutdown MLSRestart

Technique to shutdown any PC on the LAN: Create a button within MainLobby that shuts down your computer, simply create a batch file and assign it to the button. The following provides proper syntax and optional command switches. Shutdown allows you to shut down or restart a local or remote computer. Used without parameters, shutdown will logoff the current user.

Syntax shutdown [{-l|-s|-r|-a}] [-f] [-m [\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy]


-l Logs off the current user, this is also the defualt. -m ComputerName takes precedence.

-s Shuts down the local computer.

-r Reboots after shutdown.

-a Aborts shutdown. Ignores other parameters, except -l and ComputerName. You can only use -a during the time-out period.

-f Forces running applications to close.

-m [\\ComputerName] Specifies the computer that you want to shut down.

-t xx Sets the timer for system shutdown in xx seconds. The default is 20 seconds.

-c "message" Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks.

-d [u][p]:xx:yy Lists the reason code for the shutdown. The following table lists the different values. Value Description u Indicates a user code. p Indicates a planned shutdown code. xx Specifies the major reason code (0-255). yy Specifies the minor reason code (0-65536).

/? Displays help at the command prompt. Remarks If you indicate a major and minor reason code, you must first define these reason codes on each computer for which you plan to use the particular reason. If the reason codes are not defined on the target computer, Event Viewer cannot log the correct reason text. Examples To shut down \\MyServer in 60 seconds, force running applications to close, restart the computer after shutdown, indicate a user code, indicate that the shutdown is planned, log major reason code 125, and log minor reason code 1, type:

C:\windows\system32\shutdown -r -f -m \\MyServer -t 60 -d up:125:1

C:\windows\system32\shutdown -s -f -t 00

Example Commands

Can be called from an myServerCMD of another computer:


Application|Move~ <>~ <>

Application|Shift~ <>~ <>

Application|hide (Hides MainLobby but still is running in Task Manager)

Application|show Application|maximize

Application|restore Application|exit

Application|onTop~true (Keeps MainLobby on Top of other Applications)

Application|onTop~false Application|sendToBack System|shutdown myServerConnection|connect~ <>~ <> • ie: myServerConnection|connect~localhost~5004 • ie: myServerConnection|connect~

MLDVDLobby|DLnextMovie • From myServerCMD line: • MLCmd|MLCommand~htpc2~MLDVDLobby|DLnextMovie




setProperty|BackgroundFX~visible~true setProperty|BackgroundFX~visible~false setProperty|BackgroundFX~visible~toggle

setProperty|RemoteFX~visible~true setProperty|RemoteFX~visible~false

setProperty|RemoteFX~visible~toggle setProperty|OverlayFX~visible~true

setProperty|OverlayFX~visible~false setProperty|OverlayFX~visible~toggle MLHome (Loads user specified Startup Scene from Startup Options Panel)



Macro|MLSliders|Set~1~{{value}}!SetVariable|slider1~{{value}} (used when using a graphical slider. Sets a Variable at the target value, waiting for the device the then update the new value. Reduces slider bounce)

Advanced Users

Sample SWF commands

Open an application example: _root.client.myServerSocket.send(" <>");


Navigation examples: _root.client.myServerSocket.send("MLCmd|ChangeScene~ {{Clientname}}");


_root.client.myServerSocket.send("Macro|SetVariable|ClientRequesting~{{Clientname}}!MLCmd|MLCommand~ {{Clientname}}~ClientRequesting~MLminimize"); (maybe not correct)

Command Maps

Command Maps or Command Mapping allows a user to leverage large collections of myServer commands using simple "English Language" notation.


With a command map, instead of typing MLVolume|WaveVolumeUp in the MLServCmd field, you could simply type Volume.Wave.Up and achieve the same results.

This is easily accomplished because myServer already includes a command map called Volume.Wave.Up.

RunCmdMap| = Command Map Command

By reviewing the Command Mapping option, you can see a description of what the command does and the commands actual myServer syntax. This allows you to look at how the original syntax was constructed.

Macros become much more manageable as users migrate to the Macro Builder system in command mapping.

The Import File becomes a central repository of "Known Good Commands" that help users in debugging because they could be assured that it's not a syntax problem.

The command maps are stored in the command.mdb Access tables in the MLS root dir. To add a new command map, simply right click on the Commands tree where you want to insert the new command, and click New. Then, populate the appropriate new command name, description and myServerCMD Run fields.  Click Save and then Close.

You can also Import command maps by right clicking on Macros (in the navigation tree) and selecting Import. Browse to the <>.cmd file and click the Open button. You can also Export command maps by right clicking on the command you want to export (in the navigation tree) and clicking Export. Name the file appropriately. You can then share your command maps with another MainLobby3 Server user. Note, that you need to delete a command map before importing the same name command map or you will have double entries.

Command map trick

Using an MLConditional command to test for and run the application as follows:

Macro|MLConditional|IsRunning##Yahoo! Music Jukebox Plus####MLFileOpen|C:\Program Files\Yahoo!\Yahoo! Music Jukebox\YahooMusicEngine.exe##

The problem is that since the running application name includes a '!', myServer thinks that a new command begins after 'IsRunning##Yahoo' and does not execute correctly.

Is there any way to make myServer ignore the '!' and execute correctly? Answer: Do that as a Macro (which then looks for the !) and do that portion in a command map. Then call that command map from a Macro.

myServerCmds can also be invoked externally:

http:// <>:6246/command? <>

Example of use with IFTTT service:

Setup your router to ONLY forward port "X" to 6246 both TCP/UDP on whatever IP myServer runs. Make port X something odd like 8567. This will be the example going forward.

Make sure you have a static IP or use noip or something similar. 

Start your trigger in IFTTT, and for the "that" use the Maker channel and:
Make a web request: command in ml, macro, etc>>
Method = GET
Content Type = Text/plain
Body (leave blank)

And Viola - now you can use IFTTT. I've been playing with Echo, but there's limited echo "ifs" - but it works.

Playing audio sounds:

You can play any audio file from the server including all the TechTalker files.

The command syntax is 
PlaySound|<<path to any audio file>>

You can also chain Playsound commands together in a Macro like

Macro|PlaySound|sounds\At the Tone The Time Is.mp3!PlaySound|sounds\{{currenthr}}.mp3!PlaySound|sounds\{{currentampm}}.mp3

The myAVAgent also supports a similar PlaySound command. The only difference is that you must pass the full UNC path to the audio file to make sure the Agent can correctly access it.

AV|<<id>>~PlaySound|<<UNC path to any audio file>>


System Timers:

"System Timers" window and native "Timers" server command to the UI. The Timer functions are a direct replacement for the legacy MLTimer plugin. See the attached.

There is no practical limit to the number of system timers that can get defined (the system may get a little sluggish after 4000 or so).

Each system timer runs asynchronously in its own thread.

The same command set is supported as the legacy MLTimer.



Task Scheduling:

Task Scheduling functionality built into the server. This new Task Scheduler replaces the legacy MLScheduler V3 plugin. Using the new scheduler you will be able to set up an unlimited number of tasks that can either be executed on a timed schedule or on demand. You'll see the new Task Scheduler icon on the server toolbar in the Configuration Aides sections.

Six types of tasks can be defined. Hourly, Daily, Monthly, On Startup, On Demand and On Shutdown.

Hourly tasks will run each hour on the minute value specified in the Time Of Day field as long as the task is active for the current Month and Day.

Daily tasks will run each day on the hour and minute value specified in the Time Of Day field as long as the task is active for the current Month and Day.

Monthly tasks will run each month on the Day of Month specified and on the hour on the minute value specified in the Time Of Day field as long as the task is active for the current Month.

On Startup tasks will run when the server starts.

On Shutdown tasks will run when the server shuts down.

On Demand tasks will only be executed via command.

You also have the option of defining the task as a System task. A System task will never be exposed to a user via the web service.

Finally, you have the option of the sending an email when the task was run. The email address the message gets sent to is the primary notification email address as defined in the Server's Tools Notification section.

myServer Command Tasks - with this command to can Enable/Disable/Run a task.

Tasks|<<Task#>> or <<TaskName>>~Enable,Disable,Toggle,Run

There will also be a collection of Tasks_<<id>>_ server variables that can be used with the commands.

There is a web service that can be used to build a dynamic list of tasks using the InfiniteScroll object. The myDesigner has been updated and you will see the Scheduled Tasks prototype when editing the object.


Ping Device:

Command called PingDevice
You'll pass it one parameter and it is the IP Address of the device to ping. e.g. PingDevice|

It will ping the device and create 3 server variables
Ping_<<ipaddress>>_Online - 1 (online) or 0 (offline)
Ping_<<ipaddress>>_Status - text result of the ping status
Ping_<<ipaddress>>_Time - round trip time of the ping in milliseconds.