Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cannot create object

Explorer ,
May 03, 2013 May 03, 2013

Hello,

I am trying to automate some work via scripting. So first i add the Interop.Illustrator.dll assembly to my VB.Net project.

Next i want to start illustrator visible and do my scripting. That scripting code is ready and working.

But whenever i try to create an instance of illustrator via:

AIappli = New Illustrator.Application

or

AIappli = CreateObject("Illustrator.Application")

or

AIappli = CreateObject("Illustrator.Application.CS5")

or

AIappli = CreateObject("Illustrator.Application.CS6")

I get randomly errors like "Cannot create axtivex component" or server timeout/fault/not avilable errors.......

This is very random so sometimes the above code is working, but sometimes it doesn't'!

The installation we are working on is a CS6 suit upgraded from CS5 suite.

When i go to the HKCR\CSID registry to search the progid i found:

a.jpg

So i do not understand what i am doing wrong here??

Any help on this?

Thanks.

TOPICS
Scripting
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 03, 2013 May 03, 2013

try it like this

set AIappli = CreateObject("Illustrator.Application")

Translate
Adobe
Community Expert ,
May 03, 2013 May 03, 2013

try it like this

set AIappli = CreateObject("Illustrator.Application")

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 03, 2013 May 03, 2013

Thank you, i have just another question.

How can i access something with the index number?

For example the second document.

If i look at the functions, i only see you can access it by itemkey eg. a string value eg. the document name

Is this possible by index(as integer) For example

AIappli.Documents.Item(1)

instead of

AIappli.Documents.Item("second")

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2013 May 03, 2013

you're welcome, you can use both, index or name

second document, indexes are 1 based

AIappli.Documents(2)

or, if the doc's name is "second"

AIappli.Documents("second.ai")

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 06, 2013 May 06, 2013

Hello,

This does not work.

I am converting the following article to vbscript:

http://forums.adobe.com/message/4173641

And i am stuck in the method "unlockHideLayers". If i do "doc.layers(i)" the program gives me "Illegal Argument" exception..

EDIT: OK nevermind, 1 based index as you described.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 06, 2013 May 06, 2013

OK, have a problem with the moveObjects method. Note: i am converting the script to vbscript

so i do:

dim sel

sel = currDoc.selection

moveObjects sel, appRef.Documents("tmpPortfolio")

Sub moveObjects(sel, destDoc)

   for i = 1 to sel.length

      sel(i).duplicate destDoc.Layers(sel(i).layer.name), "ElementPlacement.PLACEATEND"

   next

End Sub

But the error message i am getting is: "object required 'sel'"

Any help please? Thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2013 May 06, 2013
LATEST

But the error message i am getting is: "object required 'sel'"

is that the whole script?

currDoc is not set, as well as appRef, etc.

if you have other questions, please start a new thread, this one is getting out of topic.

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