Originally published on: Sat, 29 Aug 2009 12:18:17 +0000
In my recent posts A Command Line CD Tray Opener and A Command Line MP3 Player for Windows, I wrote code to send simple command strings to the Media Control Interface via the mciSendString() API function.
I wanted to toy more with the Media Control Interface, so I wrote another short program, mciscript.c, which reads a text file and sends commands from the text file directly to the MCI. The purpose of mciscript is to provide a simple testbed for MCI commands, but it could be used as a practical utility for media control.
mciscript.c
The script format for mciscript is simple. If a '#' character is detected in the first position of a line, that line is ignored by the input processor. This allows mciscript to have a crude commenting ability.
Blank lines are also ignored by the input processor. Please note that execution of the script does not terminate if an error occurs on a particular line of input.
All other lines of text are sent to the Media Control Interface. Please consider the following file:
mci.txt
One may invoke the above script by entering the command: mciscript mci.txt
The above script will cause some.mp3 to begin playing at 11 seconds ( 11000 milliseconds ). Then, it will play some.mpg and will repeat forever. Because of the inclusion of repeat and wait, the script will never reach the last two sections which open and close the CD tray door respectively.
At the time of this writing, a list of MCI command can be found here:
http://msdn.microsoft.com/en-us/library/ms710815(VS.85).aspx
The source and EXE files for mciscript can be found here.
http://www.mailsend-online.com/wp/mciscript.zip
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless
Save to del.icio.us
Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Subscribe!
Auto Save Clipboard Images Redux
Extending SpiderMonkey JavaScript on Windows
Rhino JavaScript to EXE with launch4j
Compiling Rhino JavaScript to Java
Directory Traversal in Rhino JavaScript
A Command-Line MP3 Player for Windows
Auto Save Images from the Clipboard
Java in a Windows EXE with launch4j
An Interview with Tom Zimmer: Forth System Developer
Setting Windows Console Text Colors in C
An Interview with the Creator of the BDS C Compiler
Jim Butterfield : The Commodore Guru
Scott Ballantyne: Blazin' Into Forth
Preventing Windows Screen-Saver Activation
Checking Shift States with DEBUG
MicroISV on a Shoestring
DadHacker
The Bottom Feeder
Writin' That Code!
The Recursive ISV
The Thomsen Blog
Prototypically Speaking
The Reinvigorated Programmer