/* CD Player, Version 1.01 */ /* Original version: May 24, 1998 */ /* Latest update: June 26, 1999 */ /* Start OS/2 Audio CD player, ejecting CD-ROM if in the drive */ /* Written by Rob van der Woude */ /* Needs OS/2 Multimedia Rexx Support and RexxLib installed */ /* Specify CD Audio drive letter here */ CD_drive = "H:" /* Adjust the delay between eject command */ /* and Audio CD start if necessary */ delay = 5 /* Initialize Multimedia REXX support */ call RxFuncAdd "mciRxInit", "MCIAPI", "mciRxInit" call mciRxInit /* Initialize RexxUtil */ if RxFuncQuery( "SysLoadFuncs" ) <> 0 then do call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" call SysLoadFuncs end /* Initialize RexxLib */ if RxFuncQuery( "RexxLibRegister" ) <> 0 then do call RxFuncAdd "RexxLibRegister", "RexxLib", "RexxLibRegister" call RexxLibRegister end /* Display version information */ say say " CD Player, Version 1.01" say " Written by Rob van der Woude" /* Eject CD-ROM if in the drive */ if SysDriveInfo( CD_drive ) <> "" then do call Eject call SysSleep delay end /* Start OS/2's audio CD player */ call SysOpenObject "", 0, 1 /* Wait until OS/2's audio CD player is no longer active */ do forever call DosSwitchList "title." active = 0 do i = 1 to title.0 uctitle = translate( title.i ) if pos( "COMPACT DIS", uctitle ) > 0 then active = 1 end if active = 0 then leave call SysSleep 5 end /* Eject CD if still in the drive */ if SysDriveInfo( CD_drive ) = "" then call Eject /* End of main program */ EXIT Eject: procedure /* Open the CD-Audio device and send the Sesame Open command */ rc = mciRxSendString( "open CDAudio01 alias CDA wait", "RetStr", "0", "0" ) rc = mciRxSendString( "stop CDA wait", "RetStr", "0", "0" ) rc = mciRxSendString( "set CDA door open wait", "RetStr", "0", "0" ) rc = mciRxSendString( "close CDA wait", "RetStr", "0", "0" ) return