添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Nov 18, 2013 Nov 18, 2013

I am running 64bit Illustrator version 16.0.3 on Windows 7 and when I try to run the following code in VB.Net 2010 I get

Creating an instance of the COM component with CLSID {B9D4209B-1A9A-40FF-8ABD-2636E7987BF5} from the IClassFactory failed due to the following error: 80010105 The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).

It seems that once the oIllustrator object is instantiated the application has not yet loaded completely as the menu in Illustrator has yet to appear and so any of the code in red will fail with a COM exception.

The only way I can avoid the COM exception is by adding a thread.sleep. EIther this is a bug or there must be a better way of doing this.

Of course if Illustrator is already loaded then rerunning the code is not a problem only when Illustrator isn't running and it has to load then this becomes a problem.

Originally I used CreateObject but I still had the problem.

Dim oIllustrator As New Illustrator.Application

Dim oEPS As Illustrator.Document

Dim oTextFrame As Illustrator.TextFrame

Dim oTextRange As Illustrator.TextRange

Dim xPath As String = "\\dfs\Graphics\Images\"

'Threading.Thread.Sleep(1000) 'Prevents COM Exception error 80010105 by allowing Illustrator more time to fully load

Dim oEPSSaveOptions As New Illustrator.EPSSaveOptions

oIllustrator.Application.UserInteractionLevel = Illustrator.AiUserInteractionLevel.aiDontDisplayAlerts

oEPS = oIllustrator.Open(xPath + "test.eps")

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more Nov 18, 2013 Nov 18, 2013

Based on what you are telling us, I'm not sure that I would classify this as a bug. It seems to make sense to me that if the application isn't ready that you just need to code around it. Have you tried a Try/Catch with a MsgBox to continue or some other code to work around your Exception? "Sleep" has never been one of my favorite options...  just my opinion.

-TT

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more Nov 18, 2013 Nov 18, 2013

Hi TT,

Yes I would consider this a bug if Illustrator prematurely allows the script to continue if the application object is not fully loaded. Unless there is a property or an event to say "Illustrator is now ready" the only way I am able to get around this issue is to pause the VB script momentariliy to allow Illustrator to be ready. Like I said before the code works fine if Illustrator is already running

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more