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

What does the Error code 271 mean for Ai API on Mac?

Contributor ,
Nov 23, 2011 Nov 23, 2011

Hi,

I am trying to create a new document and getting error code 271. What does mean it?

here is code --

//Start

AIDocumentHandle doc = NULL;

ASErr error = kNoErr;

ai::UnicodeString preset("Web");

error = sAIDocList->New(preset, 0, kDialogOff,  &doc ); //error = 271

//End.

Plz explain.

Thanks

TOPICS
SDK
1.4K
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
Adobe
Guide ,
Nov 23, 2011 Nov 23, 2011

271 sounds like a nonsense error. Not all errors translate into a meaning unfortunately. Have you tried passing it an empty prese just to test it? Here's the code we use (which isn't quite the same of course)

ai::UnicodeString preset;

DocumentHandle document = 0;

AIErr error = sDocumentList->New(preset, 0, kDialogOn, &document);

That works for us. I'd try that to start, then try tweaking parameters one-by-one until you see what fails. Probably it doesn't like the 'Web', but I'm not sure.

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
Contributor ,
Nov 25, 2011 Nov 25, 2011

Thanks Andrew,

But it doesn't work.

Actually the scene is that I am trying to open the new doc at the time of "About to Closed Notifier".I mean when this notifier is called I am trying to open the new file in that notify block through API(as shown above).

and if more than one document is opened in the illustrator and i closed any one of them, it can not open the new doc.

Although it works fine in case, if only single document is opened in the illustrator and i closed that single document.

It works fine on windows in both cases.But I cant understand what happens in mac why it doesn't work in case of multiple documents.

Plz explain.

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
Guide ,
Nov 25, 2011 Nov 25, 2011
LATEST

So to make sure I understand you: you're running this code in response to an 'about to close' notifier, and if the document being closed is the only one open, the code works. But if there are any other documents open, it doesn't?

That's definitely odd. I know that code works when documents are open because we use it in that situation. We've never run it when a document is closing though, so that may be the problem. Have you tried running it via a menuitem as a test? I'm guessing that works fine, but just to double-check.


If the timing is an issue, you might try a kludgey workaround. You could create an AITimer with a period of zero. That means it will fire as soon as Illustrator is finished closing the document and is idle. At that point, you can disable the timer and try running your code. It's clumsy, but it might work.

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