Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturing File Count
Message
De
28/08/2017 17:05:26
 
 
À
28/08/2017 16:41:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 10
Divers
Thread ID:
01653809
Message ID:
01653811
Vues:
72
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform