Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error Subscript is outside defined Range
Message
From
14/03/2013 06:39:29
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Error Subscript is outside defined Range
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01568322
Message ID:
01568322
Views:
45
Using the following code i am getting error as Error Subscript is outside defined Range.

Not able to solve it, kinldy Correct
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
Sample File Used for the above code can be downloaded from
https://www.dropbox.com/s/7reg69thb5i13fq/1021165156.ps

Regards
Harsh
Next
Reply
Map
View

Click here to load this message in the networking platform