Just thought I would share something that really makes it nice to run Acad under OS/2! You can 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. version 2: Changed some prompts to look better. Added a couple of rexx routines. Added another piece of functionality to the main acad_run_scr_array.cmd routine. See Below. Problems: Programs in OS/2 seem to steal the Focus at different times from the user, like when they first start up. Because the main acad run scr array.cmd routine is constantly going into and out of autocad it is constantly stealing the Focus from the user. THIS IS LOUSY! This does not happen in Unix. IBM needs to fix this problem. I wrote to them about this a long time ago and just recently and they said they have it written down but do not have it as a problem to be worked on. They said to send in a problem report. We need to complain to get this fixed! 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 ================================================== ================================================== /* mksixs.cmd program */ /* written by Stan Towianski November 1994 */ /** Makes numbered .scr acad script files from a file list. **/ start_time = time() debug_flag = n rc=charout( , "File list to subdivide ? " ) parse upper pull in_file rc = stream(in_file,"c",'open read') If rc \= 'READY:' then Do say 'Problem with file ' in_file End prev_path = filespec( "path", in_file ) rc=charout( , "Directory to save files to ("prev_path") ? " ) parse upper pull out_file_path if ( out_file_path = '' ) then out_file_path = prev_path else Do if ( right( out_file_path, 1 ) \= '\' ) then out_file_path = out_file_path||"\" End rc = stream(out_file_path,"c",'query exists') If rc \= '' then Do say 'Problem with file ' out_file_path End filenum = 1 done_flag = no Do until lines(in_file) = 0 | done_flag = yes /* open output file */ out_file = out_file_path||"many"||filenum||".scr" say "Working on file "out_file if ( debug_flag = y ) then say "file 1 is "out_file if stream(out_file,"c",'query exists') \= '' then DO del out_file say deleted preexisting file END rc = stream(out_file,"c",'open write') rc = lineout( out_file, "attreq 0") ins_val = 0 Do count = 1 to 6 if ( lines(in_file) = 0 ) then Do say "Quiting on end of file" done_flag = yes leave End Parse value linein(in_file) with in_line tline = "insert "in_line rc = lineout( out_file, tline) tline = "0,"ins_val rc = lineout( out_file, tline) rc = lineout( out_file, "") rc = lineout( out_file, "") rc = lineout( out_file, "") ins_val = ins_val + 24 End rc = lineout( out_file, "_zoom e") tline = "_saveas c:\pwd\manypl"||filenum rc = lineout( out_file, tline) rc = lineout( out_file, "quit y") rc = stream(out_file,"c","close") filenum = filenum + 1 /* if ( filenum > 15 ) then done_flag = yes */ end /* do */ rc = stream(in_file,"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! ** Version 2: Fixed a problem: In the other wait loop scheme I think it waited 30 seconds ** and then started looking to see if the xx.dwk (lock file) was gone which assumed ** that acad was done with that process. Unfortunately if the session had a problem ** and stopped and never created a xx.dwk file my loop thought it was done and would ** start the next acad session resulting in multiple sessions! And worse was if the 2nd ** session had a problem (usually the same one) the same would happen and another ** session would get spawned and you would end up with acad starting all over the ** place. So I now do better by waiting for an initial xx.dwk file so I know it started ** and then wait for it (xx.dwk) to leave meaning it finished. ** 1.) The first way is to create your list of files to work on thru mklist.cmd, then edit ** the list, then run acad_run_scr_array.cmd to have it bring up each dwg in the list ** and run the designated script on it. ** 2.) I also added the ability to start acad with a none file "x.dwg" and then have it ** run an array of scripts on this (blank) x.dwg. The x.dwg is just a placeholder to start ** acad with no particular dwg. Here I want to start with a blank dwg and run a script1 ** to do what I want, in my case insert say 6 files and save it as one file many1.dwg. ** Then open x.dwg (blank) and run script2.scr (insert 6 dwg.s) and save to many2.dwg ** I was doing this to insert 6 dwg.s onto one to plot them and save paper. Inserting ** multiple dwg.s has it's own headache though if one dwg has a layer "basic" that is ** thawed and the next has a "basic" layer unthawed, because the x.dwg set layer "basic" ** to thawed and makes any later inserted layer "basic" take the first value of thawed ** meaning you miss the layer on the x.dwg which has the 6 dwg.s */ start_time=time() debug_flag = n Do Until ( good_setup = "YES" ) rc=charout( , "File list to work from or 'X' for none ? " ) parse upper pull in_file if ( in_file \= 'X' ) then Do do_filelist=YES rc = stream(in_file,"c",'open read') If rc \= 'READY:' then Do say 'Problem with file ' in_file exit End End else Do in_line="x.dwg" do_filelist=NO End rc=charout( , "AutoCAD script to run ? " ) parse upper pull script if ( right( script, 4 ) = ".SCR" ) then Do script=left( script, length( script ) - 4 ) End rc=charout( , "Do you want to run an array script (no) ? " ) parse upper pull ans do_array=ck_yn( ans, "FULL", "NO" ) if ( do_array = "YES" ) then Do do_array = YES rc=charout( , "Starting index ? " ) parse upper pull array_start rc=charout( , "Maximum index ? " ) parse upper pull array_max End else Do do_array = NO array_start = 1 array_max = 1 End if ( do_array = YES ) then say "Will do array scripts from "script||array_start" to "script||array_max else say "Will do single script "script rc = charout( , "Is this correct (yes) ? " ) parse upper pull ans say good_setup=ck_yn( ans, "FULL", "YES" ) End /* until */ /* if ( stream(script||".scr","c",'query exists') = '' ) then DO say script||".scr file does not exist" exit END */ fcount=1 done = NO Do until done = YES if ( do_filelist = YES ) then Do 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="c:\acadwin\acad" in_line script*/ baseline="start /win /min c:\acadwin\acad" in_line script point=lastpos( '.dwg', in_line ) dwk_file=overlay( '.dwk', in_line, point ) del_bak="del "||overlay( '.bak', in_line, point ) End else Do baseline="start /win /min c:\acadwin\acad" x script dwk_file="c:\acadwin\x.dwk" del_bak='' End /* say "before loop line ="baseline"="*/ Do count = array_start to array_max if ( do_array = YES ) then Do line=baseline||count End else line=baseline /* say "would do line ="line"="*/ say "[dwg "fcount", script "count"]" line /* Look for initial .dwk file to signify it started */ hold_on=yes do while( hold_on = yes ) say "waiting for initial lock file "dwk_file if ( stream( dwk_file, 'c', 'query exists' ) \= '' ) then Do hold_on=no End else Do say "sleeping 3 seconds" say "[dwg "fcount", script "count"]" call SysSleep 3 End End hold_on=yes do while( hold_on = yes ) say "waiting for lock file to leave"dwk_file if ( stream( dwk_file, 'c', 'query exists' ) = '' ) then do hold_on=no end else Do say "sleeping 3 seconds" say "[dwg "fcount", script "count"]" call SysSleep 3 End End del_bak end /* do */ if ( do_filelist = YES ) then Do if ( lines(in_file) = 0 ) then done = YES End else Do done = YES End fcount = fcount + 1 end /* do */ if ( do_filelist = NO ) then Do rc = stream(in_file,"c","close") End say "Start Time = "start_time say "End Time = "time() exit ================================================== ================================================== ================================================== /* ck_yn */ test=substr( arg(1), 1, 1 ) /*say "will test char ="test"="*/ if ( arg(1) = '' ) then Do ans=arg(3) End else if ( test = Y | test = y ) then Do ans=YES End else if ( test = N | test = n ) then Do ans=NO End else Do return ERROR End if ( arg(2) = "FULL" ) then return ans else return substr( ans, 1, 1 ) ================================================== /* mkplotr12.cmd */ /* written by Stan Towianski February 1995 */ /** Makes a plotr12.scr file from all dwg.s in the directories you give to plot ** all the files. Plot one file first to get setting correct. ** Then run acadplot.cmd **/ 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 plotr12.scr" if stream(plotr12.scr,"c",'query exists') \= '' then DO del plotr12.scr say deleted preexisting file END rc = stream(plotr12.scr,"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( plotr12.scr, "plot" ) rc = lineout( plotr12.scr, tfile ) rc = lineout( plotr12.scr, "e" ) rc = lineout( plotr12.scr, "n" ) rc = lineout( plotr12.scr, "lpt2" ) say "lineout rc ="rc End end /* do */ rc = lineout( plotr12.scr, "quit" ) rc = lineout( plotr12.scr, "y" ) rc = stream(plotr12.scr,"c","close") say "Start Time = "start_time say "End Time = "time() exit ================================================== ================================================== /* acadplot.cmd */ cc="start /win /min /b c:\acadwin\acad -p c:\pwd\plotr12" cc ================================================== ================================================== many1.scr example array of script files. would have many2.scr, many3.scr ... The attreq 0 says to not ask for attribute values upon inserting a dwg and just take the defaults. ========== attreq 0 insert K:\CNTRL\M189PLOT\c65\189c6545.dwg 0,0 insert K:\CNTRL\M189PLOT\c65\189ecpl.dwg 0,24 insert K:\CNTRL\M189PLOT\c65\189c6506.dwg 0,48 insert K:\CNTRL\M189PLOT\c65\189c60l2.dwg 0,72 insert K:\CNTRL\M189PLOT\c65\189c6512.dwg 0,96 insert K:\CNTRL\M189PLOT\c65\189c6513.dwg 0,120 _zoom e _saveas c:\pwd\manypl1 quit y ================================================== ================================================== /* 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