/* Quick & dirty installer for Kon 2.10 */

CALL RxFuncAdd 'SysCreateObject','RexxUtil','SysCreateObject'

SAY
SAY 'Press <ENTER> to create 5 WPS objects for Kon...'
SAY
PULL .
SAY

base=Directory()
IF Right(base,1)<>'\' THEN base=base||'\'

errors=0
IF Stream('FOLDERKON.ICO','C','QUERY EXISTS')='' THEN DO
   errors=errors+1
   SAY 'Error: the file' base||'FOLDERKON.ICO is missing'
END
IF Stream('FOLDERKON2.ICO','C','QUERY EXISTS')='' THEN DO
   errors=errors+1
   SAY 'Error: the file' base||'FOLDERKON2.ICO is missing'
END
IF Stream(base||'help\index.html','C','QUERY EXISTS')='' THEN DO
   errors=errors+1
   SAY 'Error: the file' base||'help\index.html is missing'
END
IF Stream(base||'readme.txt','C','QUERY EXISTS')='' THEN DO
   errors=errors+1
   SAY 'Error: the file' base||'readme.txt is missing'
END
IF Stream(base||'KONOS2.EXE','C','QUERY EXISTS')='' THEN DO
   errors=errors+1
   SAY 'Error: the file' base||'KONOS2.EXE is missing'
END

IF errors>0 THEN DO
   SAY
   SAY 'Installation aborted.'
   SAY
   IF Stream(base||'KON.REG','C','QUERY EXISTS')<>'' THEN DO
      SAY 'Optional: rename (or delete) the file' base||'KON.REG'
      SAY '          to avoid that the improved About-dialog will display the'
      SAY '          registered name too. Without KON.REG a blank line will'
      SAY '          be displayed by the dialog. '
      SAY
   END
   SAY 'Press <ENTER>...'
   SAY
   PULL .
   EXIT
END

IF SysCreateObject('WPFolder','Kon','<WP_DESKTOP>','ICONFILE='||base||'FOLDERKON.ICO;ICONNFILE=1,'||base||'FOLDERKON2.ICO;BACKGROUND='||base||'bmp\background.bmp;OBJECTID=<KonFOLDER>','R') THEN SAY '[1/5] Kon folder'
IF SysCreateObject('WPUrl','Kon help','<KonFOLDER>','URL='||base||'help\index.html','R') THEN SAY '[2/5] Kon help'
IF SysCreateObject('WPUrl','Kon homepage','<KonFOLDER>','URL=http://www.koneditor.com','R') THEN SAY '[3/5] Kon homepage'
IF SysCreateObject('WPProgram','readme.txt','<KonFOLDER>','EXENAME='||base||'KONOS2.EXE;PARAMETERS='||base||'readme.txt','R') THEN SAY '[4/5] readme.txt'
IF SysCreateObject('WPProgram','Kon','<KonFOLDER>','EXENAME='||base||'KONOS2.EXE','R') THEN SAY '[5/5] Kon'

SAY
SAY 'Done.'
SAY

IF Stream(base||'KON.REG','C','QUERY EXISTS')<>'' THEN DO
   SAY 'Optional: rename (or delete) the file' base||'KON.REG'
   SAY '          to avoid that the improved About-dialog will display the'
   SAY '          registered name too. Without KON.REG a blank line will'
   SAY '          be displayed by the dialog. '
   SAY
END
IF Stream(base||'KON.REG','C','QUERY EXISTS')='' THEN DO
   SAY "The file KON.REG is missing. That's okay. No problem. The About-"
   SAY 'dialog will display a blank line instead of the registered name,'
   SAY 'which earlier was "os2world.com" because of their efforts.'
   SAY
END

SAY 'Press <ENTER>...'
SAY
PULL .

EXIT
