Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Launcher() or Loader() - Best practices
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00456354
Message ID:
00456451
Views:
26
>Ed Rauh and George Tasker just mentioned they use a Launcher() for LAN apps.
>
>I am in the process of creating a new launcher for an app. I want to throw my old one away and re-do it properly. What's the consensus/best practices?
>
>1) What's best: compare local.exe and lan.exe datetime stamp or use aGetFileVersion() and read compare build numbers?
>
>i.e. ADir() vs. aGetFileVersion()
>
>n = ADIR(laLocal, "MyProg.Exe")				&& find local copy
>IF n > 0
>   n = ADIR(laRemote, lcCSSPath + MAINPROGRAM)	&& find remote copy to compare
>   * compare name and date/time stamp
>   IF (laLocal[1,3] == laRemote[1,3]) and (laLocal[1,4] == laRemote[1,4])
>      * they are equal
>   ELSE
>      * different, inform user and update local copy
>   ENDIF
>ENDIF
>
>
>2) Keep workstation's mapping data in local Config.fpw (requires recompile of local laucher.exe?). Or use Registry (using registry.vcx or sfregistry.vcx or similar). Or an INI. Maybe a local Setup.XML file instead of a setup.INI?
>
>3) A little unrelated best practice Q: If Registry is used, and the same prg needs to instantiate WSH/FSO fpor other things, is it worth to eliminate the registry class and just use WSH as it can also read/write registry?
>
>I use Doug Hennig's SFRegistry.vcx which is excellent.
>WSH 's registry functions are a little more limited than SFRegistry.
>
>i.e.
>
>oReg = CREATEOBJECT("SFRegistry")
>lcDataPath = ADDBS(oReg.GetKey(lcSubkey, lcDataKeyName))
>* or
>lcDataPath = loWshShell.RegRead("HKCU\" + ADDBS(lcSubkey) + lcDataKeyName)
>
>
>SFRegistry has oReg.IsKey() while WSH does not have a direct way to query if a key exists (that I can see).
>
>So, is it worh to have both instantiated or just throw one away for this proj.
>
>4) Am I wasting too much time on a simple task and there are online samples to look at, not to reinvent the proverbial wheel?
>
>TIA

Alex,

I can't speak for Ed, but I can speak for what I do. Part of my installation routine is a post-setup executable that does a number of things, including checking for and installing, if necessary, the WSH. It also writes out a customized script file that's used as the launcher. While there may be issues with user timezone settings, since I may go months without an update, this has proven as reliable as it needs to be. I think I've posted this before, but the script looks like this:
Dim oFSO, oLocal, oRemote, cExe, cLocal, cRemote, oShell, cParm
cExe = "My_app.EXE"
cLocal = "C:\VFPLOCAL\"
cRemote = "F:\VFPREMOTE\"
cParm = " -cC:\VFPLOCAL\My_app.fpw"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oRemote = oFSO.GetFile(cRemote & cExe)
If Not oFSO.FileExists(cLocal & cExe) Then
  oRemote.Copy cLocal
Else
  Set oLocal = oFSO.GetFile(cLocal & cExe)
  If oRemote.DateLastModified > oLocal.DateLastModified Then
    oRemote.Copy cLocal
  End if
End if
oShell.Run(cLocal & cExe & cParm)
Pretty simple and straight forward I think.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform