Windows Shell Command Dialog

Top  Previous  Next

When a sequence is started, Light-O-Rama can optionally also execute an arbitrary Windows command, running any program that you specify.

 

For example, some people broadcast the songs that play during their shows over radio, and would like the name of the song to be broadcast along with it, using the RDS ("Radio Data System") protocol, allowing people with RDS-enabled radios to see the name of the song that they are listening to.  RDS is not directly supported by Light-O-Rama, but you could set up your musical sequences so that, whenever one of them is played, Light-O-Rama will tell Windows to tell your RDS program to broadcast the name of the song for that sequence.

 

To set up a sequence to execute a Windows command, select "Windows Command" from the Sequencer's Sequence menu.  After that, whenever that sequence is played by the Show Player, the command will be executed. You can also choose whether the command is run when played in the Sequencer.

 

Important notes:

the command will not be executed if the sequence it is associated with is used as a subsequence of another sequence.

if the Show Player is running when you change the command associated with a sequence, you may have to stop and start the Show Player in order for this change to be picked up.

This feature is available only at the Advanced feature level and higher.

 

Topics:

Control Whether Commands Are Run When Played in the Sequencer

Reuse Existing Command

Create New Command

Shell Command Variables

Sharing Sequences between Computers, and Security

Examples

 

The Windows Shell Command dialog

The Windows Shell Command dialog

 

 

Control Whether Commands Are Run When Played in the Sequencer

 

The commands you enter on this screen will be run when the sequence is played by the Show Player. Depending on your situation, you may or may not want these commands to run when they are played in the Sequencer. You can control this behavior on the Sequencer Preferences Playback tab.

 

 

Reuse Existing Command

 

Select the "Existing Command" radio button and choose a command from the drop-down list to use a command that was already set up for another sequence. Both sequences will run the same command when they start.

 

The CopyButton  button copies the selected existing command to the "new command" box so you can use an existing command as the basis for a new one.

The DeleteButton button deletes the selected command. This will affect all sequences that use the same command; so be very certain that the command is no longer needed before deleting it. If your intent is that the current sequence no longer run a command, use the "No command" radio button instead.

 

 

Create New Command

 

Select the "New Command" radio button for creating an entirely new command, not used by any other sequence. If your command is an executable file or batch file (.EXE, .BAT, or .CMD extension), you can use the "Select" button to select the desired file and the full path to the file will be placed in the new command text box. Your command can also include special shell command variables as noted below.

 

 

Shell Command Variables

 

For the most part, a shell command will be executed exactly as you type it.  You can, however, additionally use certain variables, which will be replaced at run-time with various information, such as the title of the song associated with the sequence.  The following variables can be used (note: the exact result of using any of the date/time "DT_" variables may depend upon your computer system, so try them out if you need to rely upon an exact format):

 

Variable

Meaning

%%

A single percent character ("%")

%DT_a%

Day of week, abbreviated ("Mon")

%DT_A%

Day of week ("Monday")

%DT_b%

Month name, abbreviated ("Aug")

%DT_B%

Month name ("August")

%DT_c%

Date and time ("Sunday, March 09, 2008 4:05:07 PM")

%DT_d%

Day of month (01 through 31)

%DT_H%

Hour, 24 hour clock (00 through 23)

%DT_I%

Hour, 12 hour clock (01 through 12)

%DT_j%

Day of year (001 through 366)

%DT_m%

Month number (01 through 12)

%DT_M%

Minute (00 through 59)

%DT_p%

AM or PM

%DT_S%

Second (00 through 61)

%DT_w%

Day of week, number (0 through 6, Sunday being 0)

%DT_x%

Date ("11/29/10")

%DT_X%

Time ("16:32:37")

%DT_y%

Year, two digit ("10")

%DT_Y%

Year, four digit ("2010")

%ENV_something%

The value of your computer's environment variable "something"; for example, use %ENV_PATH% to get the value of your computer's PATH environment variable

%MEDIA_ALBUM%

The name of the album that this sequence's media file is from (if set in your sequence)

%MEDIA_ARTIST%

The name of the artist that this sequence's media file is by (if set in your sequence)

%MEDIA_FILENAME%

The name of the sequence's media file, without path information

%MEDIA_FILENAME_FULL%

The name of the sequence's media file, with path information

%MEDIA_FILENAME_NO_EXT%

The name of the sequence's media file, without path information and without the file extension (such as ".mp3")

%MEDIA_TITLE%

The name of the song that this sequence's media file is (if set in your sequence)

%SEQUENCE_AUTHOR%

The author of this sequence (if set in your sequence)

%SEQUENCE_CREATED_AT%

The date and time at which the sequence was created

%SEQUENCE_FILENAME%

The name of the sequence file, without path information

%SEQUENCE_FILENAME_FULL%

The name of the sequence file, with path information

%SEQUENCE_FILENAME_NO_EXT%

The name of the sequence file, without path information and without the file extension (such as ".lms")

%SEQUENCE_MODIFIED_BY%

The name of the person who has modified the sequence (if set in your sequence)

 

 

These variables were supported in prior versions, but are no longer supported in S5

Variable

Meaning

%DT_U%

Week of year, with the first Sunday of the year starting week 01 (00 through 53)

%DT_W%

Week of year, with the first Monday of the year starting week 01 (00 through 53)

%DT_Z%

Time zone ("EST")

 

 

Sharing Sequences between Computers, and Security

 

The ability to execute an arbitrary Windows command is very powerful, and even potentially harmful - for example, you could execute a command which will install spyware on your machine.  Therefore, it would not be wise to execute whatever Windows command another person chose, unless you are absolutely sure that the command they chose is safe and harmless.

 

For this reason, Light-O-Rama imposes a security measure: The command to be executed is not stored directly in the sequence file itself.  Instead, the sequence file contains a key for an entry in another file ("cmdmap.lcm", located in your Light-O-Rama sequences directory); that entry specifies the Windows command to be executed.  If that file doesn't contain an entry for that key, Light-O-Rama simply does not execute any command when the sequence plays.

 

So, you can use sequences created by other people without fear of spyware or other harmful programs, as long as you continue to use your own version of cmdmap.lcm, not a copy of the other person's cmdmap.lcm.

 

However, this means that if you yourself use Light-O-Rama on two separate machines - for example one to create your sequences on, and another to run your shows on - you will have to copy your "real" version of cmdmap.lcm from one machine to the other if you want your sequences to execute Windows shell commands.  You would typically do this at the same time that you copy your sequences themselves over from one machine to the other.

 

 

Examples

 

Update a File

 

The following command will write the media file name to a file called "NowPlaying.txt" in the your Documents folder.

 

cmd /c echo %MEDIA_FILENAME% > %USERPROFILE%\documents\NowPlaying.txt

 

WindowsShellCommandEx1

 

Let's break this command down:

 

"cmd /c" starts a Windows shell command processor. The "/c" is an option that tells the command processor to run the command that follows it and then terminate.

"echo" is a command that outputs the text that follows it.

"%MEDIA_FILENAME%" is one of the Light-O-Rama command variables noted above.

">" redirects the output to a file.

"%USERPROFILE%\documents\NowPlaying.txt" is the name of the file where the output gets written. "%USERPROFILE%" is a Windows environment variable that usually points to "C:\Users\Your-Account-Name".

 

Call a Batch File

 

In this example, we will pass the media title, artist, and album to a batch file for further processing. First, create a new batch file using Microsoft Notepad or a similar text editor. We suggest putting it in your Documents folder with the file name "NowPlaying.bat". Here is the contents, which you can copy/paste into your text editor. Feel free to modify it to suit your own needs.

 

 

rem Light-O-Rama batch file example

rem

rem This batch file accepts the media title, artist, and album as parameters 

 

rem Get the path to this file

set MyPath=%~dp0

 

rem Get the parameters that were passed in

rem The tilde removes the double-quotes surrounding the parameter

set title=%~1

set artist=%~2

set album=%~3

 

echo Now playing %title% by %artist% from the album %album% > "%MyPath%\NowPlaying.txt"

 

 

 

This batch file accepts 3 parameters, formats the output nicely, and then saves it to a text file called "NowPlaying.txt" (located in the same folder as the batch file itself).

 

To create a command in the Sequencer that calls this batch file, follow these steps:

 

1.Click the "New Command" radio button

2.Click the "Select..." button

3.Once the Select File dialog opens, navigate to your batch file and select it, and then click the "Open" button.

4.The name of the batch file is now displayed in the text box. Append the following text to it (including the double-quotes):

 

 "%MEDIA_TITLE%" "%MEDIA_ARTIST%" "%MEDIA_ALBUM%"

 

WindowsShellCommandEx2