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

PutFileDialog immediately returns kCanceledErr on mac

New Here ,
Nov 04, 2022 Nov 04, 2022

Copy link to clipboard

Copied

hi everyone, 

 

I'm encountering an issue very similar to this old post:

https://community.adobe.com/t5/illustrator-discussions/problem-in-putfiledialog-and-getfiledialog/m-...

 

AIUserSuite::PutFileDialog() works great on windows, but on mac it returns kCanceledErr immediately without waiting for user input. The code snippet below is called inside a 

csxs event callback.

 

	AppContext appContext(gPlugin->GetPluginRef());
	ai::FilePath ioFilePath;
	AIFileDialogFilters dlgOpts;
	dlgOpts.AddFilter(ai::UnicodeString("TIFF (*.tif)"), ai::UnicodeString("*.tif"));
	const ai::UnicodeString title( "Where do you want to save the exported file?" );
	ai::UnicodeString defaultName;
	const AIErr err = sAIUser->PutFileDialog( title, &dlgOpts, defaultName, ioFilePath );

 

Any insights would be greatly appreciated. 

 

Thanks much in advance,

 

David

TOPICS
SDK

Views

79

Likes

Translate

Translate

Report

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

New Here , Nov 23, 2022 Nov 23, 2022

I figured this out - replying to my own question in case it helps anyone.

 

Turns out this has to do with (undocumented?) interaction between CEP and AIP. 

In my particular case, the following sequence occurs:

  • User clicks 'export' button on the CEP modal.
  • The plugin dispatches 'export' event to AIP, then closes the CEP modal with CSInterface().closeExtension();
  • AIP receives the 'export' event and pops sAIUser->PutFileDialog() to prompt for file save location

What I found was that the CEP closeExtension

...

Likes

Translate

Translate
New Here ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

LATEST

I figured this out - replying to my own question in case it helps anyone.

 

Turns out this has to do with (undocumented?) interaction between CEP and AIP. 

In my particular case, the following sequence occurs:

  • User clicks 'export' button on the CEP modal.
  • The plugin dispatches 'export' event to AIP, then closes the CEP modal with CSInterface().closeExtension();
  • AIP receives the 'export' event and pops sAIUser->PutFileDialog() to prompt for file save location

What I found was that the CEP closeExtension() call causes Illustrator to issue an abortModal() or something similar on the AIP side, causing any modal opened there to immediately close (this happens with native swift modal window, such as NSSavePanel, as well). If I keep the CEP modal open, than the PutFileDialog stays open as well.

Likes

Translate

Translate

Report

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