home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / jlist01.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-10-09  |  2KB  |  81 lines

  1. /* Script to install JList */
  2.  
  3. /* Install the needed functions from RexxUtil */
  4. call RxFuncAdd 'SysCreateObject','RexxUtil','SysCreateObject'
  5. call RxFuncAdd 'SysIni','RexxUtil','SysIni'
  6. call RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'
  7. call RxFuncAdd 'SysDriveMap','RexxUtil','SysDriveMap'
  8.  
  9. /* Search the executable */
  10. exe=find('jlist.exe')
  11. if exe='' then
  12. do
  13.   say 'JLIST.EXE could not be found. Aborting.'
  14.   exit
  15. end
  16.  
  17. say 'Installing 'exe
  18.  
  19. /* Create a program object for JList on the desktop */
  20. if SysCreateObject('WPProgram','JList','<WP_DESKTOP>','EXENAME='exe';OBJECTID=<JLIST>','u') then
  21.   say 'A JList program object has been created on the desktop.'
  22. else
  23.   say 'The JList program object could not be created.'
  24.  
  25. /* If the system doesn't know the file type Kanjifont, we tell him
  26.    about it. Setting the USER_INI entry is a little cheating, but i
  27.    don't know a 'legal' way to create a new type without an assosiated
  28.    program */
  29. if SysIni(,'PMWP_ASSOC_TYPE','Kanji Font')='ERROR:' then
  30.   call SysIni ,'PMWP_ASSOC_TYPE','Kanji Font','00'x
  31.  
  32. /* Now we set the fonts (if they are not already set) */
  33. /* Courier is a nice ASCII font to use, as it is monospaced */
  34. if SysIni(,'JList','AsciiFontName')='ERROR:' then
  35. do
  36.   call SysIni ,'JList','AsciiFontName','Courier'"00"x
  37.   call SysIni ,'JList','AsciiFontStyle','0000'x
  38. end
  39.  
  40. /* Search the kanji font */
  41. dfont=find('k16x16.f00')
  42. if dfont='' then
  43. do
  44.   say 'The kanji font could not be found. You will be able to run JList,'
  45.   say 'but before you can display anything you have to open a kanji font.'
  46. end
  47. else 
  48. do
  49.   say 'Using the kanji font 'dfont
  50.   if SysIni(,'JList','KanjiDispFont')='ERROR:' then
  51.     call SysIni ,'JList','KanjiDispFont',dfont"00"x
  52. end
  53.  
  54. exit
  55.  
  56. find:
  57. arg file
  58.  
  59. /* First we take a look into the current directory */
  60. call SysFileTree file,files,'fo'
  61. if files.0\=0 then 
  62.   return files.1
  63.  
  64. /* If we didn't find it there, the current drive is next */
  65. call SysFileTree left(directory(),2)'\'file,files,'fos'
  66. if files.0\=0 then 
  67.   return files.1
  68.  
  69. /* Still nothing? Then we search all other drives */
  70. drives=SysDriveMap()
  71. do drive=1 to words(drives)
  72.   /* We have already searched the current drive */
  73.   if word(drives,drive)\=left(directory(),2) then
  74.     call SysFileTree word(drives,drive)'\'file,files,'fos'
  75.   if files.0\=0 then
  76.     return files.1
  77. end
  78.  
  79. /* Ok, i give up */
  80. return ''
  81.