lcStr = filetostr('1021337392.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 = [1021337392.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)) = [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)) 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>30 INTO ARRAY X SELECT MAX(Pos) FROM Dummy WHERE Pageno=I INTO ARRAY Y STORE Y-X+1 TO Occoupiedrange(I) STORE (x-30) TO unoccoupiedrange(I) ENDF **** LAST PARA FOR I=2 TO (lnPageCount-1) IF unoccoupiedrange(I)> occoupiedrange(I+1) NeXTTEXT='%%Page: '+ALLTRIM(STR(I+1))+" "+ALLTRIM(STR(I+1)) LOCATE FOR ps=NeXTTEXT Skip-1 Replace ps WITH NeXTTEXT SKIP Replace ps WITH '0 -72 6 mul translate' I=I+1 ENDIF ENDFOR ENDIF>>Thanks Sir,
>>SELECT Dummy >>set textmerge to Myfile.ps >>scan >>\<< tRIM(pS) >> >>endscan >>set textmerge to >>set textmerge off >>>>
>SELECT Dummy >set textmerge to Myfile.ps >scan >\\<< tRIM(pS) >> >\ >endscan >set textmerge to >set textmerge off >>