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 •Sharing Sequences between Computers, and Security
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 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 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):
These variables were supported in prior versions, but are no longer supported in S5
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
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.
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%"
|