7 Replies Latest reply on Nov 30, 2017 9:00 AM by LeoTaro

    Problem in PutFileDialog and GetFileDialog

    selvakkanit19061983 Level 1

      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

        • 1. Re: Problem in PutFileDialog and GetFileDialog
          LeoTaro Level 4

          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);

           

          1 person found this helpful
          • 2. Re: Problem in PutFileDialog and GetFileDialog
            selvakkanit19061983 Level 1

            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

            • 3. Re: Problem in PutFileDialog and GetFileDialog
              LeoTaro Level 4

              It works fine for me. When do you call this code? What else is your plugin doing?

              • 4. Re: Problem in PutFileDialog and GetFileDialog
                selvakkanit19061983 Level 1

                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.

                • 5. Re: Problem in PutFileDialog and GetFileDialog
                  LeoTaro Level 4

                  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);

                  }

                  • 6. Re: Problem in PutFileDialog and GetFileDialog
                    selvakkanit19061983 Level 1

                    Thank you for your replay,

                     

                    But your code yet not work.

                    I will attached Project with your code.

                     

                    FreeGrid.zip - Google Drive

                     

                    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?

                    • 7. Re: Problem in PutFileDialog and GetFileDialog
                      LeoTaro Level 4

                      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.