Hi,
First, I would like to congrat you for your VisioAutomation project: it’s really useful!
I’ve discovered some issues with the Connect-VisioApplication cmdlet: in the latest versions, it doesn’t connect to a running Visio instance. To be more precise:
* VisioPS 1.0 and 1.3 -> it correctly connects to an already running visio instance, standalone or embedded on other programs
* Visio 1.5 -> it correctly connects to a standalone visio process, but not to the embedded ones
* Visio 1.7 -> it doesn’t connect to any visio process
For last case, I’ve got the following output:
```
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> Connect-VisioApplication
Name ID Version
---- -- -------
Microsoft Visio 14,0
PS C:\Windows\system32> New-VisioDocument
New-VisioDocument : No Visio Application available
At line:1 char:1
+ New-VisioDocument
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VisioDocument], VisioApplicationException
+ FullyQualifiedErrorId : VisioAutomation.Scripting.VisioApplicationException,VisioPS.Commands.New_VisioDocument
PS C:\Windows\system32> $PSVersionTable
Name Value
---- -----
PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18051
BuildVersion 6.2.9200.16628
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2
PS C:\Windows\system32> [System.Environment]::OSVersion.Version
Major Minor Build Revision
----- ----- ----- --------
6 2 9200 0
PS C:\Windows\system32> (Get-WmiObject -class Win32_OperatingSystem).Caption
Microsoft Windows 8 Enterprise
PS C:\Windows\system32> Get-WmiObject -Query "Select * From Win32_Product Where Name Like 'Microsoft Office Visio%'"
IdentifyingNumber : {90140000-0054-0409-1000-0000000FF1CE}
Name : Microsoft Office Visio MUI (English) 2010
Vendor : Microsoft Corporation
Version : 14.0.6029.1000
Caption : Microsoft Office Visio MUI (English) 2010
IdentifyingNumber : {90140000-0054-0C0A-1000-0000000FF1CE}
Name : Microsoft Office Visio MUI (Spanish) 2010
Vendor : Microsoft Corporation
Version : 14.0.4763.1000
Caption : Microsoft Office Visio MUI (Spanish) 2010
IdentifyingNumber : {90140000-0057-0000-1000-0000000FF1CE}
Name : Microsoft Office Visio 2010
Vendor : Microsoft Corporation
Version : 14.0.6029.1000
Caption : Microsoft Office Visio 2010
```
I’ve been taking a glance on the code and I think that a good clue to this issue is that it started happening when AttachedVisioApplication substituted Globals.Application as the internal reference to the attached Visio instance (Connect_VisioApplication.cs), but I’ve not really debugged it so I don’t really know the root cause.
Comments: Indeed there was bug that was introduced some time ago that caused this. The latest version (VisioPS 1.1.12) fixed this issue. Thanks for you help in tracking this down!
First, I would like to congrat you for your VisioAutomation project: it’s really useful!
I’ve discovered some issues with the Connect-VisioApplication cmdlet: in the latest versions, it doesn’t connect to a running Visio instance. To be more precise:
* VisioPS 1.0 and 1.3 -> it correctly connects to an already running visio instance, standalone or embedded on other programs
* Visio 1.5 -> it correctly connects to a standalone visio process, but not to the embedded ones
* Visio 1.7 -> it doesn’t connect to any visio process
For last case, I’ve got the following output:
```
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> Connect-VisioApplication
Name ID Version
---- -- -------
Microsoft Visio 14,0
PS C:\Windows\system32> New-VisioDocument
New-VisioDocument : No Visio Application available
At line:1 char:1
+ New-VisioDocument
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VisioDocument], VisioApplicationException
+ FullyQualifiedErrorId : VisioAutomation.Scripting.VisioApplicationException,VisioPS.Commands.New_VisioDocument
PS C:\Windows\system32> $PSVersionTable
Name Value
---- -----
PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18051
BuildVersion 6.2.9200.16628
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2
PS C:\Windows\system32> [System.Environment]::OSVersion.Version
Major Minor Build Revision
----- ----- ----- --------
6 2 9200 0
PS C:\Windows\system32> (Get-WmiObject -class Win32_OperatingSystem).Caption
Microsoft Windows 8 Enterprise
PS C:\Windows\system32> Get-WmiObject -Query "Select * From Win32_Product Where Name Like 'Microsoft Office Visio%'"
IdentifyingNumber : {90140000-0054-0409-1000-0000000FF1CE}
Name : Microsoft Office Visio MUI (English) 2010
Vendor : Microsoft Corporation
Version : 14.0.6029.1000
Caption : Microsoft Office Visio MUI (English) 2010
IdentifyingNumber : {90140000-0054-0C0A-1000-0000000FF1CE}
Name : Microsoft Office Visio MUI (Spanish) 2010
Vendor : Microsoft Corporation
Version : 14.0.4763.1000
Caption : Microsoft Office Visio MUI (Spanish) 2010
IdentifyingNumber : {90140000-0057-0000-1000-0000000FF1CE}
Name : Microsoft Office Visio 2010
Vendor : Microsoft Corporation
Version : 14.0.6029.1000
Caption : Microsoft Office Visio 2010
```
I’ve been taking a glance on the code and I think that a good clue to this issue is that it started happening when AttachedVisioApplication substituted Globals.Application as the internal reference to the attached Visio instance (Connect_VisioApplication.cs), but I’ve not really debugged it so I don’t really know the root cause.
Comments: Indeed there was bug that was introduced some time ago that caused this. The latest version (VisioPS 1.1.12) fixed this issue. Thanks for you help in tracking this down!