Title: Z! Controller
======

Rexx code:
==========

/* Z! mini controller */

PosX = Arg(1)
PosY = Arg(2)
PipeName = '\pipe\zmp3'

if DragItem.0 = 0 then
    if PosY >= 50 then do
        select
            when PosX <= 33 then do
                rc = lineout(PipeName, '*pause')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            when (PosX > 33) & (PosX <= 66) then do
                rc = lineout(PipeName, '*stop')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            when PosX > 66 then do
                rc = lineout(PipeName, '*vol+')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            otherwise
                nop
        end
    end; else do
        select
            when PosX <= 33 then do
                rc = lineout(PipeName, '*previous')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            when (PosX > 33) & (PosX <= 66) then do
                rc = lineout(PipeName, '*next')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            when PosX > 66 then do
                rc = lineout(PipeName, '*vol-')
                rc = stream(PipeName, 'C', 'CLOSE')
            end
            otherwise
                nop
        end
    end
else do
    do F = 1 to DragItem.0
        if (Right(FileSpec('name', DragItem.F), 3) = 'mp3')|,
           (Right(FileSpec('name', DragItem.F), 3) = 'MP3')
        then
            message = '*play ' || DragItem.F
        else
            message = '*addlist ' || DragItem.F

        rc = lineout(PipeName, message)
        rc = stream(PipeName, 'C', 'CLOSE')
    end F
end

