Skip navigation
francovago
Currently Being Moderated

Execute hidden filter with explicit target

May 31, 2012 6:50 AM

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

 
Replies
  • Currently Being Moderated
    Jun 1, 2012 12:45 PM   in reply to francovago

    No. If you want to edit pixels you must target the document and the layer in question. You can do some things via targetting, mostly to read values.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 5, 2012 9:37 AM   in reply to francovago

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 8, 2012 2:09 PM   in reply to francovago

    You need to *play* the switching of the layer and then *play* the hidden filter. See the AutomationFilter example.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 8:13 AM   in reply to francovago

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points