Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setup Wizard
Message
From
29/02/2000 15:04:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Setup Wizard
Miscellaneous
Thread ID:
00339360
Message ID:
00339360
Views:
38
Hey all you Mere Mortals! Have you ever installed an application at a client site and tried to handle application upgrades? If you use the Setup Wizard to create a netsetup installation, I created a routine that will check the local and server stf files and automatically run setup in quiet mode. Create a new method in your application object called CheckVersion and a new property called lCheckVersion.

Use Suprcls to copy the do() method code into your application subclass and insert the following code:
	This.ReleaseSplash()
ENDIF

*--------------------------------------------
*--- Check the version information
*--------------------------------------------
IF This.lCheckVersion
	IF !This.Checkversion()
		RETURN .F.
	ENDIF
ENDIF
In the CheckVersion method, insert the following:
LOCAL lcEXE, lcLocalSTF, lcRemoteSTF, lnLocalHandle, lcLocalVersion, ;
	ltLocalVersion, lnRemoteHandle, lcRemoteVersion, ltRemoteVersion, ;
	lcRemoteSetup, lcOldDefault

IF VERSION(2) <> 0
	RETURN .T.
ENDIF

CREATE CURSOR stfcursor (cText C(65))
*--------------------------------------------------------
*--- Get a reference to the Local STF file
*--------------------------------------------------------
lcEXE = SYS(16,0)
IF VERSION(2) <> 0
	lcLocalSTF = getfile("STF", "Open STF file")
ELSE
	lcLocalSTF  = ADDBS(JUSTPATH(lcEXE))+"Setup\Setup.stf"
ENDIF

*--------------------------------------------------------
*--- Open the local STF file and grab the second line
*--------------------------------------------------------
IF FILE(lcLocalSTF)
	APPEND FROM &lcLocalSTF TYPE SDF
	REPLACE ALL cText WITH STRTR(cText, CHR(9),"-")
	GO TOP
	SKIP
	lcLocalVersion = stfcursor.cText

*--------------------------------------------------------
*--- Get a reference to the Source STF file
*--------------------------------------------------------
	GOTO 10
	lcRemoteSTF = ;
		ALLTRIM(SUBSTR(stfcursor.cText, AT("-", stfcursor.cText)+1))
	lcRemoteSTF = LEFT(lcRemoteSTF, RAT("\", lcRemoteSTF))+ "Setup.stf"
	ZAP
ELSE
	=ERRORMSG("Local setup file not found")
	RETURN .F.
ENDIF

*--------------------------------------------------------
*--- Parse the datetime info out of the string
*--------------------------------------------------------
lcLocalVersion = SUBSTR(lcLocalVersion, 13)
ltLocalVersion = CTOT(SUBSTR(lcLocalVersion,6,2)+"/"+;
	SUBSTR(lcLocalVersion,9,2)+"/"+LEFT(lcLocalVersion,4)+" "+ ;
	SUBSTR(lcLocalVersion,12,8))

*--------------------------------------------------------
*--- Open the remote STF file and grab the second line
*--------------------------------------------------------
IF FILE(lcRemoteSTF)
	APPEND FROM &lcRemoteSTF TYPE SDF
	REPLACE ALL cText WITH STRTR(cText, CHR(9),"-")
	GO TOP
	SKIP
	lcRemoteVersion = stfcursor.cText
ELSE
	=ERRORMSG("Remote setup file not found")
	RETURN .F.
ENDIF

*--------------------------------------------------------
*--- Parse the datetime info out of the string
*--------------------------------------------------------
lcRemoteVersion = SUBSTR(lcRemoteVersion, 13)
ltRemoteVersion = CTOT(SUBSTR(lcRemoteVersion,6,2)+"/"+;
	SUBSTR(lcRemoteVersion, 9,2)+"/"+LEFT(lcRemoteVersion,4)+" "+ ;
	SUBSTR(lcRemoteVersion,12,8))

*--------------------------------------------------------
*--- Compare the two time stamps and run the setup if the
*--- user chooses to.
*--------------------------------------------------------
IF ltRemoteVersion > ltLocalVersion
	lcRemoteSetup = ADDBS(JUSTPATH(lcRemoteSTF)) + "Setup.exe /Q"
	IF YesNo("A later version of this application is available. Do you wish to upgrade?")
		RUN &lcRemoteSetup
	ENDIF
	RETURN .F.
ELSE
	RETURN .T.
ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform