Hello,
I would know if it is possible execute, in automation filter, an hidden filter with explicit target. I would apply a modified hidden filter on all image open in photoshop,
at this moment I use PIUSelectByIndex to select an open document and after I execute hidden filter on selected image.
How could I execute directly hidden filter on the image without use PIUSelectByIndex?
I try something like:
func()
{
...
sPSActionReference->Make(&reference);
sPSActionReference->PutIndex(reference,classDocument,1); //1,2,3... and so on
sPSActionDescriptor->Make(&descriptor);
sPSActionDescriptor->PutReference(descriptor,keyNull,reference);
// This code is copied by Automation Filter example
sPSActionDescriptor->PutEnumerated(descriptor,keyCommand,typeCommand, command);
sPSActionControl->StringIDToTypeID(HiddenUniqueString,&hiddenEventID) ;
sPSActionControl->Play(&result,hiddenEventID, descriptor, plugInDialogSilent);
...
}
but it doesn't work, hidden is always applied on the active document.
Thanks,
Franco
Hi,
I try to add index of classBackgroundLayer ( I tried classLayer too).
func()
{
...
sPSActionReference->Make(&reference);
sPSActionReference->PutIndex(reference,classBackgroundLayer,0);
sPSActionReference->PutIndex(reference,classDocument,1); //1,2,3... and so on
sPSActionDescriptor->Make(&descriptor);
sPSActionDescriptor->PutReference(descriptor,keyNull,reference);
// This code is copied by Automation Filter example
sPSActionDescriptor->PutEnumerated(descriptor,keyCommand,typeCommand, command);
sPSActionControl->StringIDToTypeID(HiddenUniqueString,&hiddenEventID) ;
sPSActionControl->Play(&result,hiddenEventID, descriptor, plugInDialogSilent);
...
}
And it doesn't still work, hidden filter is always applied on selected image (and selected layer).
I read careful all the documentation and I try to find something similar in source example, but I don't find nothing...
Franco
You have to special case the background layer. Look at GetBackgroundInfo in GetInfoFromPhotoshop.cpp in the getter project.
You want to remove the two PutIndex calls above and replace with the line below. You need to check for errors as your document might not have a background layer.
error = sPSActionReference->PutProperty(reference, classBackgroundLayer, keyBackground);
I don't understand, it still doesn't work.
I do the same as GetBackgroundInfo(), but hidden filter is always only applied on selected image
func()
{
....
sPSActionControl->StringIDToTypeID("Getting Backround Layer Info", &typeID);
error = PIUGetInfo(classApplication, keyNumberOfDocuments, &numDocuments, NULL);
for (int32 docCounter = 1; docCounter <= numDocuments; docCounter++) {
error = sPSActionReference->Make(&reference);
error = sPSActionDescriptor->Make(&descriptor);
error = sPSActionDescriptor->Make(&result);
error = sPSActionReference->PutProperty(reference, classBackgroundLayer, keyBackground);
// error = sPSActionReference->PutIndex(reference, classDocument, docCounter); //I try with and without this, but it never works.
error = sPSActionDescriptor->PutReference(descriptor,keyNull,reference);
// This code is copied by Automation Filter example
error = sPSActionDescriptor->PutEnumerated(descriptor, keyCommand, typeCommand, command));
error = sPSActionControl->StringIDToTypeID(HiddenUniqueString,&hiddenEventID) );
error = sPSActionControl->Play(&result,hiddenEventID, descriptor, plugInDialogSilent);
sPSActionReference->Free(reference);
sPSActionDescriptor->Free(descriptor);
sPSActionDescriptor->Free(result);
}
....
}
I am not sure that i understand what you are asking for.
You could try to remember current layer in current document then sellect tha layer and documant that you need to work on, apply hidden filter and then return to current document or layer.
If you can not work on Backgground layer maybe you have not selected it.
truy something like:
SPErr SelectBG(/*your parameters go here*/void)
{
SPErr error = kSPNoError;
PIActionDescriptor result = NULL;
PIActionDescriptor desc000006F8 = NULL;
PIActionReference ref00000198 = NULL;
error = sPSActionDescriptor->Make(&desc000006F8);
if (error) goto returnError;
error = sPSActionReference->Make(&ref00000198);
if (error) goto returnError;
error = sPSActionReference->PutProperty(ref00000198, classLayer, keyBackground);
if (error) goto returnError;
error = sPSActionDescriptor->PutReference(desc000006F8, keyNull, ref00000198);
if (error) goto returnError;
error = sPSActionControl->Play(&result, eventSelect, desc000006F8, plugInDialogSilent);
if (error) goto returnError;
returnError:
if (result != NULL) sPSActionDescriptor->Free(result);
if (desc000006F8 != NULL) sPSActionDescriptor->Free(desc000006F8);
if (ref00000198 != NULL) sPSActionReference->Free(ref00000198);
return error;
}
That should put focus on background layer and you should be able to work on it.
Hope this helps.
Regards,
Momir
North America
Europe, Middle East and Africa
Asia Pacific