Copy link to clipboard
Copied
I have been migrated source from CS4 to CC2018.
Os: mac 10.13.1
AIFileDialogFilters ops;
sAIUser->PutFileDialog(ai::UnicodeString(Title), &ops, ai::UnicodeString(csvFileName), outCSVFile);
sAIUser->GetFileDialog(ai::UnicodeString(Title), &ops, outCSVFile);
I have problem in above code snippet. There is no dialog will opened.
And I tried to set filter of *.csv files.
But it run correctly in Windows machine.
How can I set filter to this function?
Or any other possible cases available to replace this function?
Regards,
Sandy
Copy link to clipboard
Copied
This code works for me on CC 2018 on mac:
AIFileDialogFilters filter;
filter.AddFilter(ai::UnicodeString("*.ai"));
filter.AddFilter(ai::UnicodeString("*.*"));
ai::UnicodeString path("/Users/Shared");
ai::FilePath fp(path);
sAIUser->PutFileDialog(ai::UnicodeString("Save File"),&filter,ai::UnicodeString("MyFile.ai"),fp);
Copy link to clipboard
Copied
Thank you for your reply,
Your code works but, the dialog opens and disappear automatically in fractions of seconds and Illustrator has no responds for any other input. I will quit illustrator by Force Quit... option. Is any other process to do after this snippet?
There is same problem for following snippet,
sAIUser->GetFileDialog(ai::UnicodeString("Save File"),&filter, fp);
regards,
Sandy
Copy link to clipboard
Copied
It works fine for me. When do you call this code? What else is your plugin doing?
Copy link to clipboard
Copied
fPPLib.AddEventListener(EVENT_TYPE_OK_CLICKED, OkClickedFunc, this);
static void OkClickedFunc(const csxs::event::Event* const eventParam, void* const context)
{
AIFileDialogFilters filter;
filter.AddFilter(ai::UnicodeString("*.ai"));
filter.AddFilter(ai::UnicodeString("*.*"));
ai::UnicodeString path("/Users/Shared");
ai::FilePath fp(path);
AIErr erstatus=sAIUser->PutFileDialog(ai::UnicodeString("Save File"),&filter,ai::UnicodeString("MyFile.ai"),fp);
}
It doesn't work in Event Listener function.
Other than its work fine.
Copy link to clipboard
Copied
You need to set the app context if your code is not called from a plugin message
static void OkClickedFunc(const csxs::event::Event* const eventParam, void* const context)
{
AppContext appContext(pluginRef);
AIFileDialogFilters filter;
filter.AddFilter(ai::UnicodeString("*.ai"));
filter.AddFilter(ai::UnicodeString("*.*"));
ai::UnicodeString path("/Users/Shared");
ai::FilePath fp(path);
AIErr erstatus=sAIUser->PutFileDialog(ai::UnicodeString("Save File"),&filter,ai::UnicodeString("MyFile.ai"),fp);
}
Copy link to clipboard
Copied
Thank you for your replay,
But your code yet not work.
I will attached Project with your code.
Copy this code in sample codes in Adobe Illustrator CC 2018 SDK.
Please check the code.
Run the plugin by following steps,
1. Choose Windows->SDK->FreeGrid
2. Press the “Transform” button in bottom of dialog.
Then you got an issue.
But, I will add this code as follows,
freeGridController->UnloadExtension();
sAIUser->PutFileDialog(ai::UnicodeString("Save File"),&filter,ai::UnicodeString("MyFile.ai"),fp);
Then only PutFileDialog dialog will displayed, but freeGridController dialog didn’t close because, I will UnloadExtension().
Is this correct process?
Is any other possible ways to display PutFileDialog dialog and close freeGridController dialog?
Copy link to clipboard
Copied
I can give you advice and answer questions. I don't have time to debug your code for you.
I see you are calling PutFileDialog from a csxs event callback. I have had problems before with showing popups while a panel is open. You could try unloading the extension in the callback and then setting a zero timer to call your code that calls PutFileDialog.