* This program serves as a stub for automatically updating applications in * the workstations should the executable file in a specific directory be newer. * The location of the master executable is supplied as a parameter. Example * VisualLoader "f:\program files\yTimeClock\yTimeClock.exe" Lparameters tcFileName local lcExecutable local lcMasterExecutable local lcCommand * Warn if source file name and path weren't supplied. if empty( tcFilename) MessageBox("You must supply a file name!") return 0 endif * Extract just the File Name from the drive:\path\filename string supplied. lcExecutable = JustFname( tcFileName) if file( tcfilename) * Master file exists. Let's determine whether update is warranted. If !File( lcExecutable) .or. Fdate( tcFilename,1) > Fdate( lcExecutable, 1) * Master file is newer or dest file doesn't exist. Let's update If File( lcExecutable) * Dest. executable exists. Delete it Delete File (lcExecutable) MessageBox("Deleted old version") EndIf * update the file: copy file (tcFileName) to (lcExecutable) endif endif *Execute target file once it's been copied DECLARE INTEGER ShellExecute ; IN SHELL32.DLL ; INTEGER nWinHandle,; STRING cOperation,; STRING cFileName,; STRING cParameters,; STRING cDirectory,; INTEGER nShowWindow lcOperation = "OPEN" lcWorkDir = "" *Command values: * SW_SHOWNORMAL = 1 * SW_NORMAL = 1 * SW_SHOWMINIMIZED = 2 * SW_SHOWMAXIMIZED = 3 * SW_SHOWNOACTIVATE = 4 * SW_SHOW = 5 * SW_SHOWNA = 8 * SW_SHOWDEFAULT = 10 RETURN ShellExecute(0,lcOperation,lcExecutable,"",lcWorkDir,3)