Hi,
I've been on win 10 for about six months and was pleased that all my scripts were working. Over the past week I noticed that ComObjActive("Excel.Application") is not returning anything or generates an error "Error: 0x800401e3 "Operation unavailable". I have the same issue on office 2010 and office 2016. I'm using AHK v1.1.26.01 64-bit.
I have experimented with timing and with a microsoft support article that says focus must be removed from Excel momentarily once it starts to trigger it registering with the OP system. I placed the "ComObjActive" statement in a loop and it just gets stuck there.
Any ideas?
Relayer
Anyone having issues retrieving Excel com obj?
Re: Anyone having issues retrieving Excel com obj?
Some more tinkering shows that the same construct works fine in Word 2016. Excel remains recalcitrant!
Relayer
Relayer
Re: Anyone having issues retrieving Excel com obj?
This is solved. I thought I would post the resolution just in case it might save someone the frustration of dealing with windows.
Problem recap: Upgrade to windows 10 from 7 caused my AHK script that augments Excel to not function... "operation unavailable" when trying to connect to com.
Source of problem: mismatch between "run as administrator" setting with respect to AutoHotkey or Excel keeps the connection at bay. As soon as I turned that off on Excel, everything began to function as it did before the upgrade to win 10.
Relayer
Problem recap: Upgrade to windows 10 from 7 caused my AHK script that augments Excel to not function... "operation unavailable" when trying to connect to com.
Source of problem: mismatch between "run as administrator" setting with respect to AutoHotkey or Excel keeps the connection at bay. As soon as I turned that off on Excel, everything began to function as it did before the upgrade to win 10.
Relayer
- FanaticGuru
- Posts: 1905
- Joined: 30 Sep 2013, 22:25
Re: Anyone having issues retrieving Excel com obj?
I have experienced the same things. When you google the problem you get all kinds of information about the Excel object not registering and ways to force it to register.Relayer wrote:Source of problem: mismatch between "run as administrator" setting with respect to AutoHotkey or Excel keeps the connection at bay. As soon as I turned that off on Excel, everything began to function as it did before the upgrade to win 10.
But what you don't find as easily is information about it being a permission problem that is not allowing AHK to access the Excel object, which is what the problem has always been for me.
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: Anyone having issues retrieving Excel com obj?
Hi, I'm having a different but related issue. I run Win7 64-bit, Office 2016 64-bit. I experienced the "Error: 0x800401e3 'Operation unavailable'" for weeks when I ran any script that has "ComObjActive()" using a 64-bit AHK (including Excel, which this thread is really about). However, if I switched to a 32-bit Unicode AHK, everything worked fine. GetActiveObjects() didn't show a single active object with 64-bit, but did with 32-bit. Tried with 1.1.126.01, 1.1.27.07.
Bizarrely, it seems to me, I just switched to V2 and ran a couple of suitably modified scripts, in which ComObjActive() worked fine with 64-bit.
And then when I switched back to V1, 64-bit AHK runs the ComObjActive() scripts. GetActiveObjects() also retrieves them.
(Outlook 2016 64-bit, the only one installed, is giving me problems, though. It doesn't show up in the ROT at all, which is certainly not an AHK problem, but it does mean I can't automate it. This sounds to me like a weird enough issue that I'm likely the only person having it, but if anyone else is experiencing anything similar, please let me know. I know this is straying off-topic. I'm trying Office Repair to see if that helps.
Thanks!
Regards,
burque505
Bizarrely, it seems to me, I just switched to V2 and ran a couple of suitably modified scripts, in which ComObjActive() worked fine with 64-bit.
And then when I switched back to V1, 64-bit AHK runs the ComObjActive() scripts. GetActiveObjects() also retrieves them.
(Outlook 2016 64-bit, the only one installed, is giving me problems, though. It doesn't show up in the ROT at all, which is certainly not an AHK problem, but it does mean I can't automate it. This sounds to me like a weird enough issue that I'm likely the only person having it, but if anyone else is experiencing anything similar, please let me know. I know this is straying off-topic. I'm trying Office Repair to see if that helps.
Thanks!
Regards,
burque505
- FanaticGuru
- Posts: 1905
- Joined: 30 Sep 2013, 22:25
Re: Anyone having issues retrieving Excel com obj?
You might try Excel_Get function at:burque505 wrote:(Outlook 2016 64-bit, the only one installed, is giving me problems, though. It doesn't show up in the ROT at all, which is certainly not an AHK problem, but it does mean I can't automate it. This sounds to me like a weird enough issue that I'm likely the only person having it, but if anyone else is experiencing anything similar, please let me know. I know this is straying off-topic. I'm trying Office Repair to see if that helps.
https://autohotkey.com/boards/viewtopic.php?t=31840
It goes about things a different way by first finding the Excel window and then working from there to get the object associated with the window.
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: Anyone having issues retrieving Excel com obj?
I believe I've discovered the root of my main problem, though. I have AHK set to run as Admin, and that is causing problems.
If I execute a batch file like so:
Code: Select all
AutoHotkeyU64.exe MyComObjScript.ahk
So, as was pointed out earlier, permission problems seem to be at the heart of these ComObjActive issues, one way or another.
I have noticed also that if there's a ComObjCreate executed earlier in a script, ComObjActive doesn't fail, at least for that created object.
Regards,
burque505
- FanaticGuru
- Posts: 1905
- Joined: 30 Sep 2013, 22:25
Re: Anyone having issues retrieving Excel com obj?
That is an important point, you can't just run as admin and all your permission problems will be solved. It is more about a mismatch of permissions than having "high enough" permission. Admin can create as many problems as it solves. In alot of ways running as Admin tells Windows to watch this program very carefully because it wants permission to do dangerous stuff.burque505 wrote:I believe I've discovered the root of my main problem, though. I have AHK set to run as Admin, and that is causing problems.
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: Anyone having issues retrieving Excel com obj?
I have always been bewildered by Microsoft's approach to security. I just cannot develop a mental model that works. I think most people struggle with it and just try things until it seems to work. I have summed up my thoughts in the following quotable: "Microsoft's approach to the computer interface is orthogonal to my experience as a human being".
Relayer
Relayer
Re: Anyone having issues retrieving Excel com obj?
That reminds me of something somebody at GM said about Microsoft once, after a derogatory comment by Bill Gates. I'm paraphrasing, but it went something like this:
"If cars were designed by Microsoft, you'd have to stop them with the start button." I'm sure the story has metastasized over the years - here's one link that has comments in a similar vein.
Regards,
burque505
"If cars were designed by Microsoft, you'd have to stop them with the start button." I'm sure the story has metastasized over the years - here's one link that has comments in a similar vein.
Regards,
burque505
-
- Posts: 844
- Joined: 21 Dec 2015, 02:34
Re: Anyone having issues retrieving Excel com obj?
I have the same problem with Photoshop. ComObjActive("Photoshop.Application") works fine when I have just one version of Photoshop installed, but when I install a second version on the same computer (a more recent version, for example), then I get the "Operation Unavailable" error, even though only one of the two versions is running at any given time. If I un-install one of the two versions, the error continues. I need to totally remove BOTH versions from the system, reboot, re-install only ONE version, and then it works again. So needless to say I'm, afraid to update Photoshop now because Adobe leaves the previous version installed, while adding the newer version to your computer - hence having two versions installed.
Is there a way to work around this?
Is there a way to work around this?
Re: Anyone having issues retrieving Excel com obj?
scriptor2016
You might be able to specify the version number. I don't have Photoshop. This is for Excel:
app := ComObjCreate("{00024500-0000-0000-C000-000000000046}")
or app := ComObjCreate("Excel.Application.14")
Look in the registry at HKEY_CLASSES_ROOT\Photoshop.Application\CLSID
or HKEY_CLASSES_ROOT\Photoshop.Application.XX ("XX" is a version number)
Then maybe use try/catch to try to get the application and if it fails your script can try a different version.
You might be able to specify the version number. I don't have Photoshop. This is for Excel:
app := ComObjCreate("{00024500-0000-0000-C000-000000000046}")
or app := ComObjCreate("Excel.Application.14")
Look in the registry at HKEY_CLASSES_ROOT\Photoshop.Application\CLSID
or HKEY_CLASSES_ROOT\Photoshop.Application.XX ("XX" is a version number)
Then maybe use try/catch to try to get the application and if it fails your script can try a different version.
- FanaticGuru
- Posts: 1905
- Joined: 30 Sep 2013, 22:25
Re: Anyone having issues retrieving Excel com obj?
awel20 advice is very good. It is important to realize that the Photoshop.Application is just kind of like a user-friendly alias to a CLSID. These 'aliases' are defined in the Registry which probably gets deleted when you full uninstall. The actual CLSID can be used to be more precise which version of an application you are trying to access. No two different applications every created are ever supposed to have the same CLSID. These are supposed to be total unique IDs. Randomly generated with astronomical odds of every producing two the exact same.scriptor2016 wrote:I have the same problem with Photoshop. ComObjActive("Photoshop.Application") works fine when I have just one version of Photoshop installed, but when I install a second version on the same computer (a more recent version, for example), then I get the "Operation Unavailable" error, even though only one of the two versions is running at any given time. If I un-install one of the two versions, the error continues. I need to totally remove BOTH versions from the system, reboot, re-install only ONE version, and then it works again. So needless to say I'm, afraid to update Photoshop now because Adobe leaves the previous version installed, while adding the newer version to your computer - hence having two versions installed.
Is there a way to work around this?
For example (but I would not recommend it), you could even do something like create a registry entry like "PS_COM" that had the proper CLSID property. Then you could do app := ComObjCreate("PS_COM").
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
-
- Posts: 844
- Joined: 21 Dec 2015, 02:34
Re: Anyone having issues retrieving Excel com obj?
Ha! It worked! You guys are awesome
I've been having this problem for years now, and have even inquired about it in the past but I thought it was too rare a problem for anyone to actually know what the problem was.
I can now have several versions of Photoshop installed and can use the version number to isolate the particular version which is actively running. So awesome.
Thanks guys
I've been having this problem for years now, and have even inquired about it in the past but I thought it was too rare a problem for anyone to actually know what the problem was.
I can now have several versions of Photoshop installed and can use the version number to isolate the particular version which is actively running. So awesome.
Thanks guys
Re: Anyone having issues retrieving Excel com obj?
How do you "turned that off on Excel"? I'm on a new computer with Win10 and Office365 and having similar symptoms.
Relayer
Re: Anyone having issues retrieving Excel com obj?
Sorry for digging up an old thread, but I wonder how would I do that? I have the same issue with multiple Photoshops, and I want to run a script in CC2018. But there's no Photoshop.Application for CC2018 in registry, can I manually add a CLSID? If yes, where can I find the actual ID? Thank you!FanaticGuru wrote: ↑04 Apr 2018, 12:45For example (but I would not recommend it), you could even do something like create a registry entry like "PS_COM" that had the proper CLSID property. Then you could do app := ComObjCreate("PS_COM").
-
- Posts: 844
- Joined: 21 Dec 2015, 02:34
Re: Anyone having issues retrieving Excel com obj?
On my system, I have CC2014, CC2018 and CC2019 installed.ttttt wrote: ↑27 May 2019, 03:42Sorry for digging up an old thread, but I wonder how would I do that? I have the same issue with multiple Photoshops, and I want to run a script in CC2018. But there's no Photoshop.Application for CC2018 in registry, can I manually add a CLSID? If yes, where can I find the actual ID? Thank you!FanaticGuru wrote: ↑04 Apr 2018, 12:45For example (but I would not recommend it), you could even do something like create a registry entry like "PS_COM" that had the proper CLSID property. Then you could do app := ComObjCreate("PS_COM").
For CC2014, the entry in the registry is Photoshop.Application.80
For CC2018, it's Photoshop.Application.120
For CC2019, it's Photoshop.Application.130
These values are found at HKEY_CLASSES_ROOT\Photoshop.Application.XX (where "XX" is the version number)
So for example, there are many values in the registry on my system. My registry looks something like this:
Photoshop.Application.120
Photoshop.Application.120.1 ...(I think the .1 represents an update to CC2018- for example, CC2018.1 sort of thing)
Photoshop.Application.130
Photoshop.Application.130.1 ...(same as above)
Photoshop.Application.80
Photoshop.Application.80.1 ...(same as above)
I don't know if these values will be the same on your system, but just check them out and you will find them there. Then, just trial-and-error it until you get the right ones. That's how I figured out which which value corresponded to which version of Photoshop.
So for CC2014, my line of code looks like:
Code: Select all
appRef := ComObjActive("Photoshop.Application.80")
Re: Anyone having issues retrieving Excel com obj?
Thank you for your reply. This is super weird, I also have all these Applications in registry. If I have CC2019 running and doscriptor2016 wrote: ↑27 May 2019, 08:49So for CC2014, my line of code looks like:
Code: Select all
appRef := ComObjActive("Photoshop.Application.80")
appRef := ComObjActive("Photoshop.Application")
or
appRef := ComObjActive("Photoshop.Application.130")
appRef is defined and my code works fine.
But when I have CC2018 running,
appRef := ComObjActive("Photoshop.Application")
gives me an error (I tried to wrap it in rty..catch, but the error seems to be empty)
And
appRef := ComObjActive("Photoshop.Application.120")
simply does nothing. My code doesn't work and when I try to MsgBox, %appRef%, I'm getting an empty message box
-
- Posts: 844
- Joined: 21 Dec 2015, 02:34
Re: Anyone having issues retrieving Excel com obj?
I hadn't tried that before. When I try
I also get a blank messagebox.
But rest assured, my code still works no matter which version of Photoshop I'm using.
Code: Select all
Msgbox, %appRef%
But rest assured, my code still works no matter which version of Photoshop I'm using.
Re: Anyone having issues retrieving Excel com obj?
appRef contains an object. MsgBox will always be blank. If you want something to display in the MsgBox then you need to access a member of the object that returns text .scriptor2016 wrote: I hadn't tried that before. When I try
I also get a blank messagebox.Code: Select all
Msgbox, %appRef%
Msgbox, % IsObject(appRef)