/*
        StarOffice 3.0 WPS Class & Objects Creater
		(c)1996 by IzzySoft
*/

/* Load Libs */
If RxFuncQuery('SysLoadFuncs') \= 0 Then
 Do
  Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  Call SysLoadFuncs
 End

parse arg StarDir
if StarDir = ''
 then
  do

/*	StarOffice Location	*/

   parse source . . StarDir
   parse value reverse(StarDir) with '\' StarDir
   StarDir = translate(reverse(StarDir))
   Say 'Es wurde kein Parameter bergeben, daher eine kleine Frage:'
   Say 'Wie heiát das StarOffice Hauptverzeichnis?'
   Say ''
   Say 'Ist es 'StarDir', dann einfach <Enter> drcken.'
   Say 'Andernfalls bitte das komplette Verzeichnis (incl. Laufwerk) angeben.'
   Pull Antwort
   if Antwort <> ''
    then StarDir = Antwort
 end
rc = SysFileTree(StarDir,suchdatei,d)    /* Existiert StarDir? */
if suchdatei.0 = 0 then call Error3      /* Dir existiert nicht! */

StarDLL = StarDir||'\wpswrt3.dll'

rc = SysFileTree(StarDLL,suchdatei,f)    /* Existiert StarDLL? */
if suchdatei.0 = 0 then call Error4      /* DLL existiert nicht! */


/*	What to do if Objects already exist? (fail, replace, update)	*/

ObjMode = 'fail'

/*	StarOffice Object Class Registration	*/

rc = SysRegisterObjectClass('WPStOfWri',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfDraw',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfCalc',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfMath',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfChar',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfVor',StarDLL)
if rc = 0
 then Call Error1
rc = SysRegisterObjectClass('WPStOfExe',StarDLL)
if rc = 0
 then Call Error1


/*	StarOffice WPS Objects Creation		*/

/* StarOffice Folder */
Location = "<WP_DESKTOP>"
Title = "StarOfficeFolder"
Class = "WPFolder"
SetupString = "NOTDEFAULTICON=YES;"
SetupString =  SetupString || "NOPRINT=YES;"
SetupString =  SetupString || "DETAILSVIEW=MINI;"
SetupString =  SetupString || "TREEVIEW=LINES;"
SetupString =  SetupString || "OBJECTID=<OFFICE_FOLDER3>;"

Call MakeObj


/* StarWriter */
Location = "<OFFICE_FOLDER3>"
Title = "StarWriter"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<WRITER3_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\swriter3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarWriter 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.SDW,*.VOR;"

Call MakeObj

/* StarCalc */
Location = "<OFFICE_FOLDER3>"
Title = "StarCalc"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<CALC3_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\scalc3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarCalc 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.SDC,*.VOR;"

Call MakeObj

/* StarDraw */
Location = "<OFFICE_FOLDER3>"
Title = "StarDraw"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<DRAW3_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\sdraw3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarDraw 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.SDD,*.SOC,*.SOG,*.SOB,*.SOH,*.SOD,*.SOE,*.SOP,*.VOR;"

Call MakeObj

/* StarImage */
Location = "<OFFICE_FOLDER3>"
Title = "StarImage"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<SIM_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\simage3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarImage 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.BMP;"

Call MakeObj


/* StarOffice Manager */
Location = "<OFFICE_FOLDER3>"
Title = "StarOffice Manager"
Class = "WPProgram"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<SOFFMGRWF_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\soffice3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"

Call MakeObj


/* StarChart */
Location = "<OFFICE_FOLDER3>"
Title = "StarChart"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<SCH_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\schart3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarChart 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.SCD,*.VOR;"

Call MakeObj

/* StarMath */
Location = "<OFFICE_FOLDER3>"
Title = "StarMath"
Class = "WPStOfExe"
SetupString = "NOPRINT=YES;"
SetupString =  SetupString || "OBJECTID=<FORMEL_EXE>;"
SetupString =  SetupString || "PROGTYPE=PM;"
SetupString =  SetupString || "EXENAME="StarDir"\smath3.exe;"
SetupString =  SetupString || "STARTUPDIR="StarDir";"
SetupString =  SetupString || "ASSOCTYPE=StarMath 3.0;"
SetupString =  SetupString || "ASSOCFILTER=*.SMF,*.FRM;"

Call MakeObj


/* That's all */

Exit 0


/* We all live in a yellow subroutine... */

MakeObj:
	Say 'Erstelle 'Title' in 'location' als 'Class
	rc = 0
	rc = SysCreateObject(Class,Title,Location,SetupString,ObjMode)
	if rc = 0
         then Call Error2
	return

Error1:
   Say "Fehler - konnte Klassen nicht registrieren!"
   Exit 1

Error2:
   Say "Fehler - Objekt "title" konnte nicht erstellt werden."
   Exit 2

Error3:
   Say "Das angegebene Verzeichnis existiert nicht. Bitte das StarOffice"
   Say "Hauptverzeicnis genau lokalisieren und dann dieses Programm"
   Say "erneut starten. Am einfachsten ist es, dieses Programm in das"
   Say "StarOffice hauptverzeichnis zu kopieren und von dort aus ohne"
   Say "Parameter zu starten."
   Exit 3

Error4:
   Say "Hey, ich wollte das *STAROFFICE* Verzeichnis wissen!"
   Say "Bitte nochmal berprfen und erneut versuchen. Im angegebenen"
   Say "Verzeichnis konnte ich die ntigen Dateien nicht finden."
   Exit 4
