PxPlus User Forum

Twitter Twitter Twitter

Author Topic: search installed Excel  (Read 3485 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
search installed Excel
« on: June 26, 2018, 01:38:07 AM »
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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: search installed Excel
« Reply #1 on: June 26, 2018, 08:32:51 AM »
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:

Code: [Select]
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

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: search installed Excel
« Reply #2 on: June 26, 2018, 09:55:35 AM »
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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: search installed Excel
« Reply #3 on: June 26, 2018, 10:43:51 AM »
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

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: search installed Excel
« Reply #4 on: June 26, 2018, 11:01:07 AM »
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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: search installed Excel
« Reply #5 on: June 26, 2018, 04:22:09 PM »
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

  • Silver Member
  • ***
  • Posts: 25
    • View Profile
Re: search installed Excel
« Reply #6 on: July 11, 2018, 01:52:00 PM »
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

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: search installed Excel
« Reply #7 on: July 12, 2018, 01:43:31 AM »
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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: search installed Excel
« Reply #8 on: July 12, 2018, 10:32:03 AM »
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.
« Last Edit: July 12, 2018, 02:16:37 PM by Mike King »
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com