# PM123's Remote Control

PM123 can be remotely controlled via a named pipe, `\PIPE\PM123`. Named pipes were chosen because of their excellent features. Quoting from the Control Program Programming Guide and Reference: "Named pipes enable related or unrelated processes on either the same computer system or different systems to communicate with each other. Any process that knows the name of a pipe can open and use a named pipe. In addition, named pipe data can be transparently redirected across a network, such as a local area network (LAN)".

To remote control PM123 on the same computer, you can use either the built-in "`echo`" command, or the PM123 executable itself. PM123 understands a set of commands that are written to the pipe. For example,

            [c:\usr\pm123] pm123 -cmd volume 80
            [c:\usr\pm123] echo *volume 80 > \pipe\pm123

These commands will set the volume to 80%.

            [c:\usr\pm123] pm123 -cmd add d:\music\test.mp3
            [c:\usr\pm123] echo *add d:\music\test.mp3 > \pipe\pm123

These commands will add the file `d:\music\test.mp3` to the playlist.

If you use `echo`, remember to prepend any commands sent to it with a `*` character. PM123 currently understands the following commands (optional parameters are enclosed in parenthesis):

play [<file>] | Starts playing. If `<file>` was specified, it will be first loaded and playback will be started.
stop | Stop playback.
pause [on|off] | Pauses or unpauses the playback.
next | Selects the next song in playlist.
previous | Selects the previous song in playlist.
rewind | Toggles rewind of the currently playing file.
forward | Toggles fast forward of the currently playing file.
jump <n> | Jump to `<n>` seconds in the currently playing file.
volume [[+|-]<n>] | Sets volume to `<n>`% (scale 0-100, of course). And returns previous volume setting.
load <file> | Loads a <file> into. Plays it too, if 'auto play on load' is set.
shuffle | Toggles shuffling.
repeat | Toggles repeat.
autouse on|off | Toggles 'auto use playlist on add'.
playonload on|off | Toggles 'auto play on load'.
playonuse on|off | Toggles 'auto play on playlist use'.
float on|off | Toggles 'float on top'.
font 1|2 | Selects font 1 or font 2.
size regular|small|tiny | Selects the player size.
hide | Hides the player window.
add <file>;... | Adds file(s) to playlist. Multiple files must be separated with '`;`' characters.
remove | Removes currently loaded file from the playlist.
remove dead|duplicate | Removes all non-playable or duplicate files from the playlist.
use | Use the playlist.
clear | Clears the playlist.
dir <directory> | Add `<directory>` to the playlist (non-recursive).
rdir <directory> | Add `<directory>` to the playlist (recursive).
status | Returns the player status: 'playing', 'stopped', 'paused', 'forwarding' or 'rewinding'. Can return more than one status word separated by space.
status tag|file|info | Returns the information currently displayed in the scroller or returns nothing if 'no file loaded'.
status pos | Returns the length and position of the currently played file. Returns the numbers of seconds divided by space.

Now for the cool part. You can control PM123 over your OS/2 Local Area Network. Just use `\\SERVER\PIPE\PM123`. `\\SERVER` is the name of the computer PM123 runs on. For example,

            [c:\usr\pm123] pm123 -cmd \\mycomputer volume 80
            [c:\usr\pm123] echo *volume 80 > \\mycomputer\pipe\pm123
            [c:\usr\pm123] pm123 -cmd \\mycomputer add d:\music\test.mp3
            [c:\usr\pm123] echo *add d:\music\test.mp3 > \\mycomputer\pipe\pm123

Will do the same as examples above, but from a different computer. Easy, isn't it?