Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid subscript reference
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01173721
Message ID:
01173730
Views:
12
I haven't yet checked, but I would guess we have more than 13000 files there. However, I'm attempting to use a mask, so why would it fail? Unless somehow my mask is one or two very common letters...

Anyway, looks like I have to use a different approach. I don't really want to use FileScriptingObject because it could be slower and I'm not sure it allows to specify a mask.

Do you or somebody have a suggestion for me?

Thanks in advance.

>How many files you have in that folder?
>I can't remember what was the error if ADIR() exceeds VFP limit.
>
>>Hi everybody,
>>
>>I'm using ADIR on a big directory to get files by a certain mask. We're getting "invalid subscript reference" error. I would assume, that if the array exceeds the VFP limits I would get a different error. I scanned through the code and the code always looks like
>>
>>
>>lcCheck = SUBSTR(m.lcStyle, 1, AT(m.lcNumberPart, m.lcStyle) + LEN(m.lcNumberPart) - 1)
>>	IF ADIR(laFiles, m.HomeImg + m.lcCheck + "*." + m.tcExt) >=1
>>		FOR lnI = 1 TO ALEN(laFiles,1)
>>			lcEnd = STRTRAN(JUSTSTEM(laFiles[m.lnI,1]), m.lcCheck, "")
>>			IF EMPTY(m.lcEnd) OR ISALPHA(m.lcEnd)
>>				lcFile = m.HomeImg + laFiles[m.lnI,1] && Pick up the first file if we have more than 1
>>				EXIT
>>			ENDIF
>>		NEXT
>>	ENDIF
>>
>>e.g. I always check, if ADIR returns one or more elements and then access the file name using lnI,1 in the FOR loop. I don't see how this may produce the above error.
>>
>>I used ADIR in several parts of the program the same way.
>>
>>Do you think, this error is misleading and may be result of too many files? But I always use a mask...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform