search installed Excel

Started by Thomas Bock, June 26, 2018, 01:38:07 AM

Previous topic - Next topic

Thomas Bock

Hello List ... oops ... Everyone

Currently we're looking for an installed Excel with
call "[LCL]*win/registry", err = *next, "HKEY_CLASSES_ROOT", "Excel.Application\CurVer", $$, dummy$

This doesn't work for an installed Excel-App.
Looking for a registered extension with
call "[LCL]*win/registry", err = *next, "HKEY_CLASSES_ROOT", "SystemFileAssociations\.xls\shellex", $$, dummy$
is not a possitive replacememt, because OpenOfficeCalc may have registered it.

Does someone know a way how to figure out an installed Excel-App?

Regards

Mike King

Funny you should ask about this.  We are in the middle of adding a similar check to a PxPlus utility due to recent changes in Windows 10.

The logic we are testing is:

call "[lcl]*win/registry;read",err=*next,"hkey_classes_root","excel","",_X$;
        if _X$<>"" then print "Excel Installed"


So far in our limited testing this appears to work.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

That doesn't work here. Neither on the Surface Book (Excel-App), nor on my desktop (Excel 365). We're using PxPlus V14 SCS. Both throw an error 11.

Mike King

Perhaps it is using the 64 Bit version of Excel and since PxPlus is a 32 Bit application the system is checking the 32 bit registry.

The registry accesses may need to be changed to:

call "[lcl]*win/registry;read",err=*next,"hkey_classes_root","excel","",_X$,0,64

The issue of different registries was mentioned in a Topic in the FAQ in the Knowledge base section
https://forum1.pvxplus.com/index.php?topic=22.0
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

That doesn't work either. There is simply no entry hkey_classes_root\excel, but there are very much entries hkey_classes_root\excel.<something>.

Mike King

You may have to contact Microsoft to have them advise how to tell if Excel-App is installed.  Its really not something relative to PxPlus but rather to Windows and how it registers applications.
While the Apps is likely in the C:\Program Files\WindowsApps directory -- this won't help you much as this directory cannot be accessed without Admin privileges.

There may also be a registry entry somewhere but as you are dealing with "Apps" on Windows they may be using some other form of registration process as Apps are installed quite differently than normal windows applications.

Now you might be able to use powershell to get a list of apps installed by executing:

powershell -Command get-appxpackage

  • This should be able to be piped into you PxPlus program
That will give you a ton of output but you may be able to scan for Excel-App.

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Cedric

Why not just try to open an Excel object?  If it fails, Excel isn't available?

while 1
  ExcelAvailable=0
  def object EXCEL,"[WDX]Excel.Application",err=*break
  delete object EXCEL,err=*next
  ExcelAvailable=1
  break
wend

Thomas Bock

That was our first approach in the past. But it turned out, that this creates an Excel object thus eating time. And in worse cases the installation process starts. We just want to look for the availability of Excel in order to disable/enable import and export options.
Strange enough, though the call to *win/registry fails, a def object EXCEL,"[WDX]Excel.Application" works on both systems.

Mike King

#8
This sounds like you are over reaching in trying to disable the export to EXCEL if it is not installed.  There are MANY program that can read EXCEL files and many that can create them. 

Here is a link to page that names but a few.
https://www.lifewire.com/what-is-an-xlsx-file-2622540

Unless you plan to test for all of these, suppressing the import/export could potentially cause problems for clients that don't want/need to have a fully functional EXCEL and are using some of these alternatives.

BTW: On my MAC I have iWork and when I run Windows under Parallels, I can use iWork to open and edit any XLSX file.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com