home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwplascr.zip / XWPL0208.ZIP / release / bin / newobj.cmd < prev    next >
OS/2 REXX Batch file  |  2000-01-04  |  1KB  |  45 lines

  1. /* NEWOBJ.CMD
  2.  *
  3.  * See the XFolder Online Reference for a description of what this
  4.  * file is doing.
  5.  *
  6.  * (W) (C) 1998 Ulrich Möller. All rights reserved.
  7.  * Contains enhancements suggested by John Buckley.
  8.  */
  9.  
  10. '@echo off'
  11. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  12. call SysLoadFuncs
  13.  
  14. parse arg string
  15.  
  16. /* Extract Class name and object name from string */
  17.  
  18. /* Extracts all words from 'string' beginning at word 2 and passes them to 'OName' */
  19. OName = subword(string,2)
  20.  
  21. /* Deletes all words in 'string', beginning at word 2 and passes the result to 'Class' */
  22. Class = delword(string,2)
  23.  
  24. /* Strips any trailing space characters from the string in Class */
  25. Class = strip(Class,'T')
  26.  
  27. if (OName = "") then do
  28.     Say "Usage: newobj <wpsclass> <name> [<destdir>]"
  29.     exit
  30. end
  31.  
  32. Dest = directory()
  33.  
  34. if SysCreateObject(Class, OName, Dest) = 0 then do
  35.     x = 1
  36.     do while x < 10
  37.         Name = OName||x
  38.         if SysCreateObject(Class, Name, Dest) = 1 then
  39.             x = 10
  40.         else x = x+1
  41.     end
  42. end
  43.  
  44.  
  45.