>T1=TIME() >Clear >SET DELETED ON > >lcStr = filetostr('1021165156.ps') >lnPOS = At("%%Pages:",lcStr) >lcPageCount = alltrim(substr(lcStr, lnPOS, 12)) >lnPageCount = VAL(STRTRAN(lcPageCount,'%%Pages:','')) > >IF lnPageCount>2 >DIMENSION occoupiedrange(lnPageCount) >DIMENSION unoccoupiedrange(lnPageCount) > >Local lcFile, lcText >m.lcFile = [1021165156.ps] >Create Cursor Dummy (PS c(254), pos i,pageno n(2)) >Append From (m.lcFile) Sdf > >SCAN >IF Getwordnum(PS, Getwordcount(PS)) = [x] .OR. ; >Getwordnum(PS, Getwordcount(PS)) = [y] .OR. ; >Getwordnum(PS, Getwordcount(PS)) = [L] .OR. ; >Getwordnum(PS, Getwordcount(PS)) = [w] > >m.lcText = Getwordnum(PS, Getwordcount(PS) - 1) && The second last word >IF Len(Chrtran(m.lcText, [1234567890], [])) = 0 && lcText contains only digits >Replace pos With Val(m.lcText) >Endif >ENDIF >ENDSCAN > > > >FOR I= 1 TO lnPageCount >CURTEXT='%%Page: '+ALLTRIM(STR(I))+' '+ALLTRIM(STR(I)) >NeXTTEXT='%%Page: '+ALLTRIM(STR(I+1))+" "+ALLTRIM(STR(I+1)) > >*DELETE FROM dummy WHERE ps like "%(of%" AND pageno>1 >*DELETE FROM dummy WHERE ps like "%(Page%" AND pageno>1 >*DELETE FROM DUMMY where Ps LIKE '%BHARAT SANCHAR%' AND Pageno>1 >LOCATE FOR ALLTRIM(PS)=curtext >SCAN WHILE ALLTRIM(ps)<>nexttext OR EOF()=.T. >REPLACE pageno WITH I >ENDSCAN >SELECT MIN(Pos) FROM Dummy WHERE Pageno=I AND Pos>20 INTO ARRAY X >SELECT MAX(Pos) FROM Dummy WHERE Pageno=I INTO ARRAY Y > >STORE Y-X+1 TO Occoupiedrange(I) >STORE (x) TO unoccoupiedrange(I) >STORE (x-20) TO unoccoupiedrange(I) >ENDFor > > >FOR I=2 TO (lnPageCount-1) >Blank=unoccoupiedrange(I) >Filled=occoupiedrange(I+1) > >DO WHILE Blank>=Filled >NEXTTEXT='%%Page: '+ALLTRIM(STR(I+1))+" "+ALLTRIM(STR(I+1)) >LOCATE FOR ps=NeXTTEXT >Skip-1 >Replace ps WITH NeXTTEXT >SKIP >Prefixmul= ALLTRIM(STR((Occoupiedrange(I)/68.7),18,2)) >Replace ps WITH '0 -72 &Prefixmul mul translate' >WAIT WINDOW I >Filled=Filled+occoupiedrange(I+1) >WAIT WINDOW I >I=I+1 >ENDDO >ENDFOR >ENDIF > >SELECT Dummy >set textmerge On >SET TEXTMERGE TO myfile.ps noshow >scan >\\ << tRIM(pS) >> >\ >endscan >set textmerge To >set textmerge off > >T2=TIME() >WAIT WINDOW T2 >WAIT WINDOW t1 >>