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:
00456457
Views:
29
George,

That is very similar to what I've done today as I'm almost done writing my launcher. Your idea differs from mine in that you use a script and I use WSH from inside Launcher.exe (VFP). An exterbnal script file is definityely lighter. I'll try that approach.

I also check for the mapping to exist or I attempt to create with something like this:
loFSO = CREATEOBJECT("Scripting.FileSystemObject")
loWSHNet = CREATEOBJECT('Wscript.Network')

IF !loFSO.FolderExists(ADDBS(lcDriveLetter) + lcRemotePath)
   llError = .F.
   ON ERROR llError = .T.
   IF !loWSHNet.MapNetworkDrive(lcDriveLetter, lcServerName + lcRemotePath, .t.)
      ON ERROR
      * could not map drive
      MsgSvc("Could not map drive!", lcDriveLetter + "~" + lcServerName)
      RELEASE ALL
      RETURN .F.
   ENDIF
   ON ERROR
   IF llError = .T.
      MsgSvc("Could not map drive!", lcDriveLetter + "~" + lcServerName)
      RELEASE ALL
      RETURN .F.
   ENDIF llError = .T.
ENDIF
Q: How do you test for WSH being installed in your a post-setup executable? Do you try to instantiate with CREATEOBJ()?
Q: How do you "auto" install WSH if not installed?

>>>>>>>>>>>>>>>
>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.
>>>>>>>>>>>>>>>


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform