Help finding an application path in windows

Ian McKnight iangmcknight at gmail.com
Sat Apr 21 08:16:51 EDT 2012


Hi

I'm am able to launch a file in Excel directly from LC but I do not want to
hard code the path to excel in my app.
The following code works but is this the best way to handle this situation?
What would happen if Office were upgraded for example?


  put $programFiles &"\" into tProgramFilesPath

      put "Microsoft Office\OFFICE11\excel.exe" into tStandardInstallPath
      put tProgramFilesPath & tStandardInstallPath into tFullAppFilePath

      launch fName with tFullAppFilePath

      if the result is not empty
      then
         --excel not found
         answer error "Excel cannot be located on your
system"&cr&cr&"Locate Excel or cancel?"  with "Cancel" or "Find Excel"

         if it is "Cancel" then exit to top

         answer file "Locate Excel" with filter "EXE,*.exe"
         put it into tAppPath
         launch fName with tAppPath
      end if

BTW this works for MSOffice 2003 and Win 7

Thanks in advance.

-- 
Regards


Ian McKnight

iangmcknight at gmail.com
=======================



More information about the use-livecode mailing list