/*
**  RESETOBJ.CMD
**
**  Rebuild VisPro/REXX program objects in the workplace shell desktop folder
*/

'@echo off'

CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
CALL SysLoadFuncs

CALL SysCls

SAY "This program will restore the VisPro/REXX Workplace Shell objects"
SAY "on your desktop.  You may use this program if the VisPro/REXX"
SAY "folder on your desktop was accidentally deleted or corrupted."
SAY "If you have not installed VisPro/REXX yet, you will need to do"
SAY "so before running this program."
SAY ""
SAY "Press Y to continue, or N to exit the program.  "

ANSWER=SysGetKey()
PARSE UPPER VALUE ANSWER with ANSWER

IF ANSWER <> 'Y' THEN
   EXIT
OS2_DIR= SysSearchPath('PATH','CMD.EXE')
OSDIR=LEFT(OS2_DIR,3)

CALL SysFileSearch 'SET VISPRORX=',OSDIR'CONFIG.SYS','FILE.'

i=FILE.0
IF FILE.I <> 0 THEN DO
   parse var file.i . '=' PRODUCTDIR
   SAY ""
   SAY "The VisPro/REXX objects will be reconstructed from the installation"
   SAY "found in the "PRODUCTDIR" directory."
   SAY ""
   END
ELSE DO
   SAY ""
   SAY "The VisPro/REXX path was not found in your CONFIG.SYS file."
   SAY "You need to have VisPro/REXX installed and your CONFIG.SYS file"
   SAY "updated before attempting to execute this program."
   EXIT
   END


PROJECTDIR=PRODUCTDIR'\PROJECTS'
SAMPLESDIR=PRODUCTDIR'\SAMPLES'

/* Create Workplace Shell folder for VisPro/REXX */
Call SysCreateObject "WPFolder", "VisPro/REXX", "<WP_DESKTOP>","OBJECTID=<VISPRORX>;ICONFILE=" PRODUCTDIR"\VPRFLDR.ICO", "r"

/* Create 'Projects' subdirectory within the VisPro/REXX folder */
Call SysCreateObject "WPShadow", "PROJECTS", "<VISPRORX>", "SHADOWID="PROJECTDIR||";OBJECTID=<VPPROJECTS>", "r"

/* Create 'Samples' subdirectory within the VisPro/REXX folder */
Call SysCreateObject "WPShadow", "SAMPLES", "<VISPRORX>","SHADOWID="SAMPLESDIR";OBJECTID=<VPSAMPLES>", "r"

/* Create shadow of "READLAN.ME" within the VisPro/REXX folder */
Call SysCreateObject "WPShadow", "READ.ME", "<VISPRORX>","SHADOWID="PRODUCTDIR"\read.me;OBJECTID=<VPREADME>", "r"

/* Create 'Project' template within the Projects folder of the VisPro/REXX folder */
Call SysCreateObject "WPFolder", "Project", PROJECTDIR,"TEMPLATE=YES;ICONFILE=" PRODUCTDIR'\VPRFLDR.ICO', "r"

/* Creating shadow object for the Color Palette */
Call SysCreateObject "WPShadow", "Color Palette", "<VISPRORX>","SHADOWID=<WP_CLRPAL>"||";OBJECTID=<VPCLRPAL>", "r"

/* Creating shadow object for the Font Palette */
Call SysCreateObject "WPShadow", "Font Palette", "<VISPRORX>","SHADOWID=<WP_FNTPAL>"||";OBJECTID=<VP_FNTPAL>", "r"

/* Creating shadow object for the REXX Information book */
Call SysCreateObject "WPShadow", "REXX Information", "<VISPRORX>","SHADOWID=<WP_REXREF>"||";OBJECTID=<VP_REXREF>", "r"

/* Creating shadow object for the QELIB Information book */
CALL SysCreateObject "WPProgram","Q+E Information","<VISPRORX>","EXENAME=VIEW.EXE;PARAMETERS="PRODUCTDIR"\VPQELIB.INF;STARTUPDIR="PRODUCTDIR,"r"

/* Creating shadow object for the VisPro/REXX tutorial-demo */
Call SysCreateObject "WPProgram", "Tutorial/Demo", "<VISPRORX>","EXENAME="PRODUCTDIR'\VPDEMO.EXE'||";OBJECTID=<VP_DEMO>", "r"

SAY ""
SAY "VisPro/REXX objects successfully recreated."


CALL SysDropFuncs

EXIT
