Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capturing File Count
Message
From
28/08/2017 17:05:26
 
 
To
28/08/2017 16:41:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows 10
Miscellaneous
Thread ID:
01653809
Message ID:
01653811
Views:
74
>Howdy experts,
>
>I am looking to calculate the number of files. I have a folder called bkngimgs. I want to allow my setup program to Capture the number of images that are in that irectory and then use that number to get a random number and select that file for the background image for my intial splash screen.
>
>Any ideas how to accomplish this? Is this a good approach or should I look at capturing all file names into a table and generating the random record against the table?

A concise way to do it:
* set to match your image repository and extension
#DEFINE IMAGES_REPOSITORY	"C:\Users\" + ALLTRIM(SUBSTR(SYS(0), AT("#", SYS(0)) + 1)) + "\Pictures\*.jpg"

LOCAL ARRAY Images(1)

? m.Images(EVL(ROUND(RAND() * ADIR(m.Images, IMAGES_REPOSITORY), 0), 1), 1)
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform