11 Replies Latest reply: Feb 21, 2012 2:31 PM by Abdoj RSS

    PSDExportPrefs options fails to work in CS5

    Abdoj Community Member

      Hi,

       

      The following piece of code works fine in CS4 when I change the resolution and colormodel to differnct values, but fails in CS5.

      The structure in both versions seems identical. Any idea as to why it fails in this latest version?

       

      PSDExportPrefs sExportPrefs;

      memset( &sExportPrefs, 0, sizeof(PSDExportPrefs) );
      sExportPrefs.mResolution = 300;  //dpi
      sExportPrefs.mColorModel = (PSDPluginColorMode) kPSDDefaultColorModelPref;

       

      //file name
      result = sAIActionManager->AIActionSetString( valueParameterBlock, 'name', szFullFileName );
      //file format
      result = sAIActionManager->AIActionSetString( valueParameterBlock, 'frmt', "Photoshop PSD Export" );
      //file extension
      result = sAIActionManager->AIActionSetString( valueParameterBlock, 'extn', "psd, pdd" );

      //sExportPrefs
      result = sAIActionManager->AIActionSetRawDataBytes( valueParameterBlock, 'parm',  (ASUInt32) sizeof(sExportPrefs), (const char*) &sExportPrefs );

      result = sAIActionManager->PlayActionEvent( kAIExportDocumentAction, kDialogOff, valueParameterBlock );

       

      Thanks for your help.

      Abdo

        • 1. Re: PSDExportPrefs options fails to work in CS5
          Abdoj Community Member

          Hello, anybody live here?

          • 2. Re: PSDExportPrefs options fails to work in CS5
            A. Patterson Community Member

            Sorry, busy week!

             

            Unfortunately, not much I can add. Nothing jumps out at me. Though usually the thing to do when actions fail is to perform manually what you're trying to do EXACTLY, but while recording it as an action. Then you save out the action set and pop it open in a text editor. First thing should be to make sure it doesn't have any new, undocumented parameters (I know from experience that's happened before). Compare with what you're writing out, make sure you're trying to do what they do in the same situation. It may reveal something important.

            • 3. Re: PSDExportPrefs options fails to work in CS5
              Abdoj Community Member

              Thanks for your respond.

               

              I did saved the action and looked at each line in a text editor. Actually

              that is how I figured it out to work in CS4 in the first place. But the same

              code failed in work in CS5 and I can't figure it out. I will keep trying.

               

              Thanks for you help again

              Abdo

              • 4. Re: PSDExportPrefs options fails to work in CS5
                A. Patterson Community Member

                Yes, but have you tried the same technique in CS5 to see if they do things differently? Don't assume its creating the same exact action with the same parameters as it was in CS4. I know for a fact that the Save action isn't the same between CS4 & CS5. If you haven't already, you should repeat the procedure (as annoying as it is) in CS5 and see what's changed (because something certainly seems to have changed!).

                • 5. Re: PSDExportPrefs options fails to work in CS5
                  Abdoj Community Member

                  Thanks for your replies. Sorry to respond late I was busy in a different issue.

                   

                  I tryied everything and nothing seems to work. Maybe if could able to bring up the 'Photoshop Export Options' dialog and let the user set the option might resolve my problem. But I could not find the ActionParamKeyID to fire up the dialog.

                   

                  result = sAIActionManager->AIActionSetInteger( valueParameterBlock, '????', true );

                   

                  Does anybody knows how to bring up this dialog.

                   

                  Please help

                  Thanks

                  Abdo

                  • 6. Re: PSDExportPrefs options fails to work in CS5
                    Abdoj Community Member

                    Please help!

                     

                    Does anybody knows how to bring up the 'Photoshop Export Options' dialog?

                     

                    Thanks

                    Abdo

                    • 7. Re: PSDExportPrefs options fails to work in CS5
                      A. Patterson Community Member

                      The dialog comes up based on the setting of 'show dialog' when you run the action. If you're trying to get the action to not show the file dialog, but show the options dialog, I think you're out of luck. As far as I know, there's no parameter for that on the export action itself. We had a similar problem when we were doing a PDF-based export. In the end, we just had to implement the options dialog ourselves (at least, the ones we cared about) and then plugged those into the action parameters.

                      • 8. Re: PSDExportPrefs options fails to work in CS5
                        Abdoj Community Member

                        It looks like I am at the deadend.

                         

                        The reason I wanted to show the option dialog was to be able to change the resolution and the color mode, which I was trying to do it all along via PSDExportPrefs setting - which is working fine in CS4 but not in CS5.

                         

                        Now, if I am out of luck to show the option dialog as you suggested, I am stuck with the default doc setting values and it a problem.

                         

                        I did it for the PDF-based CopyAsAction and  I expected the Export version also has the same capability.  Here the PDF version I used at the time:

                         

                        sAIActionManager->AIActionSetInteger( valueParameterBlock, kAISaveDocumentAsGetParamsKey, true );

                        sAIActionManager->PlayActionEvent( kAISaveDocumentACopyAsAction, kDialogOff, valueParameterBlock);

                         

                        and this will show the PDF option dialog and let the user set their options.

                         

                        Is there any other thing I can do to change these values in CS5?

                         

                        Thanks for your help, Patterson you really helpfull and I really appreciate that.

                        Abdo

                        • 9. Re: PSDExportPrefs options fails to work in CS5
                          A. Patterson Community Member

                          Ah, so there was a parameter that let you specify whether the dialog should be shown. It does sound like that's broken.

                           

                          The only other thing to do then would be to do what we did: write your own options dialog. You could show that, which would contain the options you're talking about, then you could take the dialog values and use them to set the parameter values of the action. Its more work, but it would do the job.

                          • 10. Re: PSDExportPrefs options fails to work in CS5
                            Abdoj Community Member

                            That is exactly what I did and fail to work in CS5 - created my own option dialog and used PSDExportPrefs to set the values. The exact code works in CS4, mind you. It's only when this attempt failed that thought of bringing up the Export Option dialog.

                             

                            Here is my peice of code that fails in CS5 but works in CS4, for the record:

                             

                               PSDExportPrefs sExportPrefs;

                               short colorModel = kPSDDefaultColorModelPref;
                               memset( &sExportPrefs, 0, sizeof(sExportPrefs) );
                               sExportPrefs.mResolution = mResolution;  //300 dpi
                               sExportPrefs.mWhichProfile = mWhichProfile;  //2 embed icc

                               if( CMYK )
                                 colorModel = (PSDPluginColorMode) ePluginCMYK; 
                               sExportPrefs.mColorModel = (PSDPluginColorMode) colorModel;

                               ActionParamKeyID key = 'parm';   //1885434477
                               result = sAIActionManager->AIActionSetRawDataBytes( valueParameterBlock, key,  (ASUInt32) sizeof(sExportPrefs), (const char*) &sExportPrefs );

                               sAIActionManager->PlayActionEvent( kAIExportDocumentAction, kDialogOff, valueParameterBlock );

                             

                            This is what I am strugling with.

                             

                            Thanks

                            Abdo

                            • 11. Re: PSDExportPrefs options fails to work in CS5
                              Abdoj Community Member

                              Hi,

                               

                              Has anybody ever successfully used the PSDExportPrefs options in CS5?. I tried everything and failed to bring up ethier the export option dialog or use this PSDExportPrefs structure to set the parameters.

                               

                              Please help.

                               

                              Thanks

                              Abdo