* 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