home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / b / bookshlf.zip / BLDINFO.CMD next >
OS/2 REXX Batch file  |  1992-10-25  |  2KB  |  60 lines

  1. /* This simple REXX script builds a folder with all available */
  2. /* books (INF files) on the system. */
  3.  
  4. /* Load REXXUTIL */
  5. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  6. call sysloadfuncs
  7.  
  8. /* The basic call is listed next.                                          */
  9. /* result = SysCreateObject(classname, title, location, setup)             */
  10.  
  11. Say 'Constructing a folder with all books'
  12.  
  13. classname='WPFolder'
  14. title='BookShelf!'
  15. location='<WP_DESKTOP>'
  16. setup='OBJECTID=<WP_BOOKSHELF>;'
  17. Call BldObj
  18.  
  19. classname = 'WPProgram'
  20. location = '<WP_BOOKSHELF>'
  21. base_setup='PROGTYPE=PM;EXENAME=\OS2\VIEW.EXE;'
  22. /* Put bookshelf stuff */
  23. BS = VALUE('BOOKSHELF',,'OS2ENVIRONMENT');
  24. Say BS
  25. Do While (BS <> "")
  26.     Parse Var BS Path ";" BS
  27.     If (Path <> "") Then Do
  28.         Path = STRIP(Path)
  29.         If (RIGHT(Path,1) <> "\") Then
  30.             Path = Path || "\"
  31.         PrevQ = Queued()
  32.         "DIR "Path"*.INF /F | RXQUEUE"
  33.         NowQ = Queued()
  34.         Do i = NowQ to PrevQ+1 by -1
  35.             Parse Pull file .
  36.             start = LASTPOS("\", file) + 1
  37.             last = LASTPOS(".", file) - 1
  38.             len = last - start + 1
  39.             title = TRANSLATE(SUBSTR(file, start, len))
  40.             setup = base_setup || "PARAMETERS="title";"
  41.             Call BldObj
  42.         End /* do */
  43.  
  44.     End  /* Do */
  45. End /* do */
  46.  
  47. Exit
  48.  
  49. /* Build Object */
  50. BldObj:
  51. call charout ,'Building: 'title
  52.  
  53. result = SysCreateObject(classname, title, location, setup)
  54.  
  55. If result=1 Then call charout ,'...   Object created!'
  56. Else             call charout ,'...   Not created! Return code='result
  57.  
  58. Say '';
  59. Return
  60.