home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / icont190.zip / getset.cmd next >
OS/2 REXX Batch file  |  1995-05-10  |  2KB  |  94 lines

  1. /* This is a REXX program 
  2.  
  3. A sample REXX file to query settings for objects using the functions
  4. in WPTOOLS.DLL.
  5.  
  6. */
  7.  
  8.  
  9. arg tCmdLine
  10.  
  11. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  12. rc = SysLoadFuncs()
  13.  
  14. call RxFuncAdd 'WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs' 
  15. rc = WPToolsLoadFuncs()
  16.  
  17. szObjectName = ""
  18. szParms = ""
  19. do i = 1 to words(tCmdLine)
  20.   tWord = word(tCmdLine, i)
  21.   select
  22.     when tWord = '/S' | tWord = '-S' then do
  23.       szParms = '/S'
  24.       iterate
  25.     end
  26.     otherwise do
  27.       if szObjectName != "" then do
  28.          say 'Invalid argument: ' tWord
  29.          exit
  30.       end
  31.       szObjectName = tWord
  32.       iterate
  33.       end
  34.    end
  35. end
  36.  
  37. if szObjectName = "" then do
  38.    say 'USAGE: GETSET OBJECTID|PATHNAME [/S]'
  39.    say ''
  40.    say 'Use OBJECTID without < and >'
  41.    say '/S - Also look in subdirs'
  42.    exit
  43. end
  44.  
  45. call SysFileTree szObjectName, 'rgFiles', 'O'
  46. if rgFiles.0 > 0 then do
  47.   do i = 1 to rgFiles.0
  48.       call GetSettings rgFiles.i, szParms
  49.   end
  50.   if szParms = '/S' Then Do
  51.     szObjectName = szObjectName || '\*.*'
  52.     call SysFileTree szObjectName, 'rgFiles', 'OS'
  53.     if rgFiles.0 > 0 then do
  54.       do i = 1 to rgFiles.0
  55.         call GetSettings rgFiles.i, szParms
  56.       end
  57.     end
  58.   end
  59.   exit
  60. end
  61.  
  62.  
  63. szObjectName = '<' || szObjectName || '>'
  64. call GetSettings szObjectName, szParms
  65.                              
  66. Exit
  67.  
  68. /***********************************************************************
  69. * GetSettings
  70. ***********************************************************************/
  71. GetSettings:
  72. iRetco = WPToolsQueryObject(ARG(1), "szClass", "szTitle", "szSetupString", "szLocation") 
  73. if iRetco Then do
  74.      say '"'szClass'", "'szTitle'", "'szSetupString'", "'szLocation'"'
  75.   end 
  76. else
  77.   say 'Unable to return object settings for ' ARG(1)
  78.  
  79. if ARG(2) = '/S' Then Do
  80.  
  81. iRetco = WPToolsFolderContent(ARG(1), "list.")
  82. if iRetco = 0 Then Do
  83.    return
  84. End
  85.  
  86. do iObject = 1 to list.0
  87.   iRetco=WPToolsQueryObject(list.iObject, "szClass", "szTitle", "szSetupString", "szLocation") 
  88.   if iRetco Then do
  89.      say '"'szClass'", "'szTitle'", "'szSetupString'", "'szLocation'"'
  90.   end 
  91. end
  92. End
  93. return
  94.