home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxac.txt
< prev
next >
Wrap
Text File
|
1995-02-12
|
6KB
|
207 lines
Just thought I would share something that really makes it
nice to run Acad under OS/2!
First save your acad windows size to something small so
then you have room to work on other stuff.
I used to do this under Unix using csh but then when I
found out how much better REXX is (csh can't work on
units smaller than strings) I now do this stuff under OS/2.
I use REXX to make automated mass changes to multiple
acad dwg.s. This is how (and why acad should be made
to work under OS/2):
The following sections should be cut and saved to separate
ascii files and run as REXX cmd programs.
Any problems/questions let me know.
Stan Towianski - CompuServe 74403,205
==================================================
/* c:\startup.cmd - called at boot time */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
exit
==================================================
/* mklist.cmd */
/* written by Stan Towianski November 1994 */
/* This let's you easily get a list of files you want to modify.
** It gives you a file called "manylist" which is a list of files
** from the directories you input. This list can then be simply
** editted and used directly by the "acad_run_scr.cmd" routine
** below.
*/
start_time=time()
debug_flag = n
say "Enter full paths of directories to include 1 per line."
say "or enter just directory name to have me assume path"
say "from previous line."
say "Enter 'end' when done."
i=0
parse upper pull ans
pathlist.i = ans
lp = lastpos( '\', pathlist.i )
prev_path = substr( pathlist.i, 1, lp )
pathlist.i = pathlist.i||"\*.dwg"
say "path #" i "is "pathlist.i
Do until ( ans = "END" )
i = i + 1
parse upper pull ans
pathlist.i = ans
lp = lastpos( '\', pathlist.i )
if ( lp = 0 ) then
pathlist.i = prev_path||pathlist.i
else
prev_path = substr( pathlist.i, 1, lp )
pathlist.i = pathlist.i||"\*.dwg"
say "path #" i "is "pathlist.i
End
max_path_idx = i - 1
say "max_path_idx ="max_path_idx
/* open output file */
if ( debug_flag = y ) then say "file 1 is manylist"
if stream(manylist,"c",'query exists') \= '' then
DO
del manylist
say deleted preexisting file
END
rc = stream(manylist,"c",'open write')
do i = 0 to max_path_idx
pathlist = pathlist.i
call SysFileTree pathlist, filelist.i, "FS", "*****"
say number of files is filelist.i.0
Do fcount = 1 to filelist.i.0
tfile = word( filelist.i.fcount, 5 )
say "working with file # [" fcount "] = " tfile
rc = lineout( manylist, tfile)
say "lineout rc ="rc
End
end /* do */
rc = stream(manylist,"c","close")
say "Start Time = "start_time
say "End Time = "time()
exit
==================================================
/* acad_run_scr.cmd */
/* written by Stan Towianski November 1994 */
/* This routine works on files in a file list and brings each dwg up
** in acad and runs the chosen script on it, and so on for each
** dwg in the list. Great when you need to modify a bunch of
** dwg's from one companies standard layering scheme etc... to
** anothers!
*/
start_time=time()
debug_flag = n
say "File list to work from ?"
parse upper pull in_file
rc = stream(in_file,"c",'open read')
If rc \= 'READY:' then
Do
say 'Problem with file ' in_file
exit
End
say "AutoCAD script to run ?"
parse upper pull script
/*script="n:\dwg\mech\l325\lay-chg\retry"*/
say "script ="script"="
Do until lines(in_file) = 0
in_line = linein(in_file)
/* the line below will run acad in win-os2 full screen - not as useful
cannot keep working on other stuff
*/
/* line="d:\acadwin\acad" in_line script*/
line="start /win /min d:\acadwin\acad" in_line script
line
call SysSleep 30
hold_on=yes
point=lastpos( '.dwg', in_line )
dwk_file=overlay( '.dwk', in_line, point )
do while( hold_on = yes )
line="dir d:\test"
line
if ( stream( dwk_file, 'c', 'query exists' ) = '' ) then
do
hold_on=no
end
else
Do
say "sleeping 3 seconds"
call SysSleep 3
End
End
line="del "||overlay( '.bak', in_line, point )
line
end /* do */
rc = stream(in_file,"c","close")
say "Start Time = "start_time
say "End Time = "time()
exit
==================================================
/* ren_to_lower.cmd */
/* written by Stan Towianski November 1994 */
/* Used to rename all filenames to lower case for use
** in a Unix/NFS environment.
*/
say "Start Time = "time()
start_time=time()
debug_flag = y
filearg = "*"
if ( words(arg(1)) = 1 ) then
Do
treeoption = "F"
filearg = word(arg(1), 1)
say "Will work on input file list ="filearg
end
else if ( words(arg(1)) = 2 ) then
Do
options = word(arg(1), 1)
filearg = word(arg(1), 2)
if ( (options = "-r") | (options = "-R") ) then
do
say "Got -R option"
treeoption = "BS"
end
else
treeoption = "F"
say "Will work on input file list ="filearg
end
else
do
say "** Syntax error: ren_to_lower {-r} files"
exit
end
call SysFileTree filearg, filelist, treeoption, "*****"
say number of files is filelist.0
Do fcount = 1 to filelist.0
tfile = word( filelist.fcount, 5 )
say "working with file # [" fcount "] = " tfile
fpath = filespec( "drive", tfile)||filespec( "path", tfile )
upfile = filespec( "name", tfile )
lofile = translate( upfile, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
say "upfile ="upfile"=" "lofile ="lofile"="
say "Would do =rename "tfile lofile
rename tfile lofile
End
say "Start Time = "start_time
say "End Time = "time()
exit