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?
memset( &sExportPrefs, 0, sizeof(PSDExportPrefs) );
sExportPrefs.mResolution = 300; //dpi
sExportPrefs.mColorModel = (PSDPluginColorMode) kPSDDefaultColorModelPref;
result = sAIActionManager->AIActionSetString( valueParameterBlock, 'name', szFullFileName );
result = sAIActionManager->AIActionSetString( valueParameterBlock, 'frmt', "Photoshop PSD Export" );
result = sAIActionManager->AIActionSetString( valueParameterBlock, 'extn', "psd, pdd" );
result = sAIActionManager->AIActionSetRawDataBytes( valueParameterBlock, 'parm', (ASUInt32) sizeof(sExportPrefs), (const char*) &sExportPrefs );
result = sAIActionManager->PlayActionEvent( kAIExportDocumentAction, kDialogOff, valueParameterBlock );
Thanks for your help.
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.
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
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!).
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.
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.
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.
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.
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:
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.
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.