Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP auto-clearing feature
Message
De
06/03/2002 10:16:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
06/03/2002 10:11:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00616964
Message ID:
00629001
Vues:
26
>Hi Hilmar,
>
>I just wrote a program, startup.exe, that checks to see if a user's exeucutable (payroll.exe) matches the latest one available out on the server.
>If the user's executable needs to be updated, startup will update payroll.exe with the latest version. It's working.
>
>I see that you wrote a launch program, too. I'm wondering if you wouldn't mind letting me have a look at the code just to see if I've done things the best way.
>
>Thanks,
>Deb

Sure. Please note that my version of the loader runs the executable directly from the server. I keep the last 30 versions on the server, and have a separate loader that lets the user choose the version. This is very useful in case I screwed up with the latest version.

See code below.

Hilmar.
* Purpose: facilitate software updates (with this program, often it will
* not be necessary for all users to log out).
* This program looks for, and executes, the executable with the highest version number
* (as indicated in the filename)
* Based on a tip (or was it an article?) in FoxPro Advisor.

#DEFINE BASENAME "PCP_"

local lnNumberOfVersions, laExeFileNames(1,1), lnI, lnIndexOfHighest, lnNumberOfHighest,;
	lnCurrentVersionNumber, lcFileName

* Get array with executables
lnNumberOfVersions = adir(laExeFileNames, BASENAME + "*.exe")
if lnNumberOfVersions = 0
	MessageBox("Error: No se encuentra el archivo " + BASENAME + "xxxx.exe.", 16, "Error al cargar el sistema")
	* MessageBox("Error: File not found " + BASENAME + "xxxx.exe.", 16, "Error loading the application")
	return
endif

* Check which one has the highest version number
lnIndexOfHighest = 1
lnNumberOfHighest = 0
for lnI = 1 to alen(laExeFileNames, 1)
	lnCurrentVersionNumber = val(substr(laExeFileNames(lnI, 1), len(BASENAME) + 1))
	if lnCurrentVersionNumber > lnNumberOfHighest
		lnIndexOfHighest = lnI
		lnNumberOfHighest = lnCurrentVersionNumber
	endif
next

* Run the program

lcFileName = laExeFileNames(lnIndexOfHighest, 1)
* ? lcFileName
run /n &lcFileName
wait window "Cargando programa principal, versión #" + transform(lnNumberOfHighest);
	timeout 10
* wait window "Loading main program, version #" + transform(lnNumberOfHighest);
	timeout 10
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform