home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxac.txt < prev    next >
Text File  |  1995-02-12  |  6KB  |  207 lines

  1. Just thought I would share something that really makes it 
  2. nice to run Acad under OS/2!
  3. First save your acad windows size to something small so
  4.  then you have room to work on other stuff.
  5. I used to do this under Unix using csh but then when I 
  6. found out how much better REXX is (csh can't work on 
  7. units smaller than strings) I now do this stuff under OS/2.
  8. I use REXX to make automated mass changes to multiple 
  9. acad dwg.s.  This is how (and why acad should be made 
  10. to work under OS/2):
  11. The following sections should be cut and saved to separate
  12.  ascii files and run as REXX cmd programs.
  13. Any problems/questions let me know.
  14. Stan Towianski - CompuServe 74403,205
  15.  
  16. ==================================================
  17. /* c:\startup.cmd - called at boot time */
  18. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  19. call SysLoadFuncs
  20. exit
  21.  
  22. ==================================================
  23. /* mklist.cmd */
  24. /* written by Stan Towianski  November 1994 */
  25. /*  This let's you easily get a list of files you want to modify.
  26. **  It gives you a file called "manylist" which is a list of files
  27. **  from the directories you input.  This list can then be simply
  28. **  editted and used directly by the "acad_run_scr.cmd" routine
  29. **  below.
  30. */
  31.  
  32. start_time=time()
  33. debug_flag = n
  34.  
  35. say "Enter full paths of directories to include 1 per line."
  36. say "or enter just directory name to have me assume path"
  37. say "from previous line."
  38. say "Enter 'end' when done."
  39. i=0
  40. parse upper pull ans
  41. pathlist.i = ans
  42. lp = lastpos( '\', pathlist.i )
  43. prev_path = substr( pathlist.i, 1, lp )
  44. pathlist.i = pathlist.i||"\*.dwg"
  45. say "path #" i "is "pathlist.i
  46. Do until ( ans = "END" )
  47.     i = i + 1
  48.     parse upper pull ans
  49.     pathlist.i = ans
  50.     lp = lastpos( '\', pathlist.i )
  51.     if ( lp = 0 ) then
  52.         pathlist.i = prev_path||pathlist.i
  53.      else
  54.         prev_path = substr( pathlist.i, 1, lp )
  55.     pathlist.i = pathlist.i||"\*.dwg"
  56.     say "path #" i "is "pathlist.i
  57. End
  58. max_path_idx = i - 1
  59. say "max_path_idx ="max_path_idx
  60.  
  61. /* open output file */
  62. if ( debug_flag = y ) then say "file 1 is manylist"
  63. if stream(manylist,"c",'query exists') \= '' then
  64.     DO
  65.     del manylist
  66.     say deleted preexisting file
  67.     END
  68. rc = stream(manylist,"c",'open write')
  69.  
  70. do i = 0 to max_path_idx
  71.     pathlist = pathlist.i
  72.     call SysFileTree pathlist, filelist.i, "FS", "*****"
  73.     say number of files is filelist.i.0
  74.  
  75.     Do fcount = 1 to filelist.i.0
  76.         tfile = word( filelist.i.fcount, 5 )
  77.         say "working with file # [" fcount "] = " tfile
  78.         rc = lineout( manylist, tfile)
  79.         say "lineout rc ="rc
  80.      End
  81. end /* do */
  82.  
  83. rc = stream(manylist,"c","close")
  84. say "Start Time = "start_time
  85. say "End   Time = "time()
  86. exit
  87.  
  88. ==================================================
  89. /* acad_run_scr.cmd */
  90. /* written by Stan Towianski  November 1994 */
  91. /*  This routine works on files in a file list and brings each dwg up
  92. **  in acad and runs the chosen script on it, and so on for each
  93. **  dwg in the list.  Great when you need to modify a bunch of
  94. **  dwg's from one companies standard layering scheme etc... to
  95. **  anothers!
  96. */
  97.  
  98. start_time=time()
  99. debug_flag = n
  100.  
  101. say "File list to work from ?"
  102. parse upper pull in_file
  103.  
  104. rc = stream(in_file,"c",'open read')
  105. If rc \= 'READY:' then
  106. Do
  107.     say 'Problem with file ' in_file
  108.     exit
  109. End
  110.  
  111. say "AutoCAD script to run ?"
  112. parse upper pull script
  113. /*script="n:\dwg\mech\l325\lay-chg\retry"*/
  114. say "script ="script"="
  115.  
  116. Do until lines(in_file) = 0
  117.     in_line = linein(in_file)
  118. /* the line below will run acad in win-os2 full screen - not as useful
  119.    cannot keep working on other stuff
  120. */
  121. /*    line="d:\acadwin\acad" in_line script*/
  122.     line="start /win /min d:\acadwin\acad" in_line script
  123.     line
  124.     call SysSleep 30
  125.     hold_on=yes
  126.     point=lastpos( '.dwg', in_line )
  127.     dwk_file=overlay( '.dwk', in_line, point )
  128.     do while( hold_on = yes )
  129.          line="dir d:\test"
  130.          line
  131.          if ( stream( dwk_file, 'c', 'query exists' ) = '' ) then
  132.              do
  133.              hold_on=no
  134.              end
  135.         else
  136.             Do
  137.             say "sleeping 3 seconds"
  138.             call SysSleep 3
  139.             End
  140.     End
  141.     line="del "||overlay( '.bak', in_line, point )
  142.     line
  143. end /* do */
  144.  
  145. rc = stream(in_file,"c","close")
  146. say "Start Time = "start_time
  147. say "End   Time = "time()
  148. exit
  149.  
  150. ==================================================
  151. /* ren_to_lower.cmd */
  152. /* written by Stan Towianski  November 1994 */
  153. /* Used to rename all filenames to lower case for use
  154. **  in a Unix/NFS environment.
  155. */
  156.  
  157. say "Start Time = "time()
  158. start_time=time()
  159. debug_flag = y
  160. filearg = "*"
  161.  
  162. if ( words(arg(1)) = 1 ) then
  163.     Do
  164.     treeoption = "F"
  165.     filearg = word(arg(1), 1)
  166.     say "Will work on input file list ="filearg
  167.     end
  168. else if ( words(arg(1)) = 2 ) then
  169.     Do
  170.     options = word(arg(1), 1)
  171.     filearg = word(arg(1), 2)
  172.     if ( (options = "-r") | (options = "-R") ) then
  173.         do
  174.         say "Got -R option"
  175.         treeoption = "BS"
  176.         end
  177.     else
  178.         treeoption = "F"
  179.     say "Will work on input file list ="filearg
  180.     end
  181. else
  182.     do
  183.     say "** Syntax error:  ren_to_lower {-r} files"
  184.     exit
  185.     end
  186.  
  187. call SysFileTree filearg, filelist, treeoption, "*****"
  188. say number of files is filelist.0
  189.  
  190.  
  191. Do fcount = 1 to filelist.0
  192.     tfile = word( filelist.fcount, 5 )
  193.     say "working with file # [" fcount "] = " tfile
  194.  
  195.     fpath = filespec( "drive", tfile)||filespec( "path", tfile )
  196.     upfile = filespec( "name", tfile )
  197.     lofile = translate( upfile, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
  198.     say "upfile ="upfile"="   "lofile ="lofile"="
  199.     say "Would do =rename "tfile lofile
  200.     rename tfile lofile
  201.  
  202. End
  203. say "Start   Time = "start_time
  204. say "End   Time = "time()
  205. exit
  206.  
  207.