;>>> RemoveEmptyTextObjects.Gxm ;>>> Cleans up your drawing of unwanted empty text objects. ;>>> Written by Vincent Ferrara 2006 ;************************************************** ;>>> Description: ;>>> FIrstly select the area of the drawing you whish to process. ;>>> Secondly you have the option of removing these objects or leave them in the last selection list. ;>>> This macro will filter out empty text strings that have no text at all or contain only non printable characters. ;>>> ;>>> History: ;>>> Revision - A. (04/03/06) ;>>> Added Tab and Ctrl+Backspace characters to search list. ; /MSP,++,MO; /VLC; /DEL; /LIST,1,-1; ; .SEARCHLIST; /VST,0, ; $S(0) = Space character /VST,3,%%CR%%; $S(3) = Newline character (carriage return) /VST,4,%%TAB%%; $S(4) = Tab character /VST,5,; $S(5) = Ctrl+Backspace character ; .SELECT; /SEL,Select Text Lines to process ...; /CEL,F,T,!,A,!,L,!; /VIN,0,$VAL; /IF,$I(0)[EQ]0,/GTO,NONEFOUND; /VIN,1,$I(0); /VIN,2,1; /VIN,3,0; /VIN,4,0; /VIN,23,1; /PMT,3,'[ESC] to Cancel',#; /SYS,T,H,/VIN,10,$VAL; /SYS,T,M,/VIN,11,$VAL; /SYS,T,S,/VIN,12,$VAL; /SYS,T,D,/VIN,13,$VAL; /VRL,1,$I(10)*3600+$I(11)*60+$I(12)+($I(13)/100); ; .LOOP; /IF,$I(1)[EQ]0,/GTO,END; .ELAPSEDTIME; /SYS,T,H,/VIN,14,$VAL; /SYS,T,M,/VIN,15,$VAL; /SYS,T,S,/VIN,16,$VAL; /SYS,T,D,/VIN,17,$VAL; /VRL,2,$I(14)*3600+$I(15)*60+$I(16)+($I(17)/100); /VIN,20,$R(2)-$R(1); /VRL,3,$I(20)/60; /VIN,21,$R(3); /VRL,4,$R(3)-$I(21); /VIN,22,$R(4)*60; /VIN,30,$I(0)-$I(1); /VIN,31,$I(30)/$I(20); /PMT,1,'Processing ',$I(30),' out of ',$I(0),' Text objects (',,$I(3),' %),%65,'Empty Text Lines found:_',[,$I(4),],#; /PMT,2,'Time taken > ',$I(21),' min ',$I(22),' sec ',,$I(31),' Text objects/sec',%65,'Time remaining > ',$I(24),' min ',#; /IF,$I(24)[LT]1,/PMT,2,'Time taken > ',$I(21),' min ',$I(22),' sec ',,$I(31),' Text objects/sec',%65,'Time remaining > ',$I(25),' sec',#; .PROCESS; /EEX,$I(1),V,8,A,/VST,2,$STR; String /STR,L,$S(2),/VIN,6,$VAL; Number of characters in a string /IF,$I(6)[EQ]0,/LIST,1,$I(1),/GTO,DONE; Text lines with no characters /IF,$S(2)[EQ]$S(0),/LIST,1,$I(1),/GTO,DONE; Text lines with single space character /IF,$S(2)[EQ]$S(3),/LIST,1,$I(1),/GTO,DONE; Text lines with single newline character /IF,$S(2)[EQ]$S(4),/LIST,1,$I(1),/GTO,DONE; Text lines with single tab character /IF,$S(2)[EQ]$S(5),/LIST,1,$I(1),/GTO,DONE; Text lines with single ctrl+backspace character /IF,$I(6)[GT]1,/GTO,SEARCH; /GTO,DONE; .SEARCH; /IF,$I(2)[GT]$I(6),/LIST,1,$I(1),/GTO,DONE; Text lines comprising of only multiple characters /STR,S,$S(2),1,$I(2),/VST,1,$STR; /IF,$S(1)[EQ]$S(0),/VIN,2,$I(2)+1,/GTO,SEARCH; Found space character /IF,$S(1)[EQ]$S(3),/VIN,2,$I(2)+1,/GTO,SEARCH; Found newline character /IF,$S(1)[EQ]$S(4),/VIN,2,$I(2)+1,/GTO,SEARCH; Found tab character /IF,$S(1)[EQ]$S(5),/VIN,2,$I(2)+1,/GTO,SEARCH; Found ctrl+backspace character /VIN,2,1; ; .DONE; /VIN,1,$I(1)-1; /VIN,3,100-(($I(1)/$I(0))*100); /VIN,4,$LIST(1); /VIN,23,(100-$I(3))/($I(3)/$I(20)); /VRL,5,$I(23)/60; /VIN,24,$R(5); /VRL,6,$R(5)-$I(24); /VIN,25,$R(6)*60; /GTO,LOOP; ; .NONEFOUND; /BEEP; /PMT,1,'None found:_',#; /PMT,2,'Time taken > ',$I(21),' min ',$I(22),' sec',#; /PMT,3,'[RET] to Retry [ESC] to End',#,/CIN; /IF,$VAL[EQ]-1,/GTO,SELECT; /IF,$VAL[EQ]-2,/GTO,EXIT; ; .END; /IF,$I(4)[EQ]0,/GTO,NONEFOUND; /PMT,1,'Empty Text Lines found:_',[,$I(4),],#; /PMT,2,'Time taken > ',$I(21),' min ',$I(22),' sec',#; /PMT,3,'[RET] to Remove from Drawing [ESC] to Store in Last selected list',#,/CIN; /IF,$VAL[EQ]-1,ER,$LIST(1),!,RD; /IF,$VAL[EQ]-2,SE,$LIST(1),!; ; .EXIT; /MSP,--,PU;