/********************************************/
/* Run this script to set up                */
/* a new desktop CDRWSEL object             */
/********************************************/

/* Prerequisites for the desktop object     */
/* and this cmd file                        */
crlf	='0d0a'x
exe	='cdrwsel.exe'
Title	='CDRWSel'
Setup	='OBJECTID=<CDRWSel>;'||,
	 'EXENAME=' || Directory() || '\' || exe || ';' ||,
	 'STARTUPDIR=' || Directory() || ';' ||,
           'ICONFILE=' || Directory() || '\cdrwsel.ico;' ||,
	 'PROGTYPE=PM;' ||,
           'PARAMETERS=-i -s -vol;' 

/* Load RexxUtil DLL                        */
call RxFuncAdd 'SysLoadFuncs' , RexxUtil, 'SysLoadFuncs'
call SysLoadFuncs
Call SysCls

say crlf crlf
say 'This script sets up the desktop object for '||Title
say 'Be sure you are running this from the '||Title||' directory.'||crlf crlf

say 'Press [Y] to continue or [Enter] to quit'||crlf
pull approval
if approval <> 'Y' then exit
say ''

/* Are we in the right program directory?   */
say 'Locating '||exe||'...'||crlf
TestFor=directory()||'\'||exe
CALL SysFileTree TestFor,'List','FO'
if List.0 = 0 then do
   say 'Please run this program from the same directory as the '||exe||' file'||crlf
   say 'Exiting...'||crlf
   exit
end

call SysCreateObject "WPProgram", Title, "<WP_DESKTOP>", Setup, 'Update'
/* Check if the WPS object was created      */
if rc = 0 then
   say 'Object creation for 'Title ' failed!  rc='||crlf
else
   say 'Object created for' Title||crlf
