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

PutFileDialog immediately returns kCanceledErr on mac

New Here ,
Nov 04, 2022 Nov 04, 2022

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
183
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

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

...
Translate
Adobe
New Here ,
Nov 23, 2022 Nov 23, 2022
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.

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