Skip navigation
Currently Being Moderated

Hot to call import plugin from automation plugin

Sep 12, 2013 1:16 AM

  Hi,

 

I was able to call filter plug-in from my automation plug-in. Now I'm stuck in calling import plug-in.

I build GradientImport example from PhotoshopSDK, and modify resource PIPL to have unique string ID. ( i.e. I changed this line HasTerminology { plugInClassID, plugInEventID, ResourceID, "" } ) and put a unique ID.

Then I tried to call it from my automation plug-in, but always I get this error: The command "AdobeSDK GradientImport" is not currently available.

 

What should I change/modify for to be able to call import plug-in (GradientImport is ok) from my automation plug-in ?

 

Thanks.

 
Replies
  • Currently Being Moderated
    Sep 12, 2013 9:41 AM   in reply to cincirin

    What does script listener give you for your new string change?

    Make sure you right click on .r file and recompile then right click on .rc file and compile when making pipl changes on windows.

     

    Here is how to call the unmodified version of GradientImport.

     

    // =======================================================

    var idImpr = charIDToTypeID( "Impr" );

        var desc1 = new ActionDescriptor();

        var idUsng = charIDToTypeID( "Usng" );

            var desc2 = new ActionDescriptor();

            var idmulK = charIDToTypeID( "mulK" );

                var list1 = new ActionList();

                    var desc3 = new ActionDescriptor();

                    var idVrtc = charIDToTypeID( "Vrtc" );

                    var idshPxl = charIDToTypeID( "#Pxl" );

                    desc3.putUnitDouble( idVrtc, idshPxl, 256.000000 );

                    var idHrzn = charIDToTypeID( "Hrzn" );

                    var idshPxl = charIDToTypeID( "#Pxl" );

                    desc3.putUnitDouble( idHrzn, idshPxl, 256.000000 );

                    var idMdspsp = charIDToTypeID( "Md  " );

                    var idgrmT = charIDToTypeID( "grmT" );

                    var idrgbC = charIDToTypeID( "rgbC" );

                    desc3.putEnumerated( idMdspsp, idgrmT, idrgbC );

                var idmulS = charIDToTypeID( "mulS" );

                list1.putObject( idmulS, desc3 );

            desc2.putList( idmulK, list1 );

        var idgraD = charIDToTypeID( "graD" );

        desc1.putObject( idUsng, idgraD, desc2 );

    executeAction( idImpr, desc1, DialogModes.NO );

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2013 8:51 AM   in reply to cincirin

    You don't need the stringid to typeid calls. GradientImport is using four character codes and you can use them directly. Here is a C++ version that should work for you. Did the JavaScript version work for you? I got this output from Listener.log.

     

    SPErr PlayeventImport(/*your parameters go here*/void)

    {

         PIActionDescriptor result = NULL;

         DescriptorTypeID runtimeKeyID;

         DescriptorTypeID runtimeTypeID;

         DescriptorTypeID runtimeObjID;

         DescriptorTypeID runtimeEnumID;

         DescriptorTypeID runtimeClassID;

         DescriptorTypeID runtimePropID;

         DescriptorTypeID runtimeUnitID;

         SPErr error = kSPNoError;

         // Move this to the top of the routine!

         PIActionDescriptor desc00000190 = NULL;

     

     

         error = sPSActionDescriptor->Make(&desc00000190);

         if (error) goto returnError;

     

     

              // Move this to the top of the routine!

              PIActionDescriptor desc00000198 = NULL;

     

     

              error = sPSActionDescriptor->Make(&desc00000198);

              if (error) goto returnError;

     

     

                   // Move this to the top of the routine!

                   PIActionList list00000028 = NULL;

                   error = sPSActionList->Make(&list00000028);

                   if (error) goto returnError;

     

     

                        // Move this to the top of the routine!

                        PIActionDescriptor desc000001A0 = NULL;

     

     

                        error = sPSActionDescriptor->Make(&desc000001A0);

                        if (error) goto returnError;

     

     

                        error = sPSActionDescriptor->PutUnitFloat(desc000001A0, keyVertical, unitPixels, 256);

                        if (error) goto returnError;

     

     

                        error = sPSActionDescriptor->PutUnitFloat(desc000001A0, keyHorizontal, unitPixels, 256);

                        if (error) goto returnError;

     

     

                        error = sPSActionDescriptor->PutEnumerated(desc000001A0, keyMode, 'grmT', 'rgbC');

                        if (error) goto returnError;

     

     

                   error = sPSActionList->PutObject(list00000028, 'mulS', desc000001A0);

                   if (error) goto returnError;

     

     

              error = sPSActionDescriptor->PutList(desc00000198, 'mulK', list00000028);

              if (error) goto returnError;

     

     

         error = sPSActionDescriptor->PutObject(desc00000190, keyUsing, 'graD', desc00000198);

         if (error) goto returnError;

     

     

         error = sPSActionControl->Play(&result, eventImport, desc00000190, plugInDialogSilent);

         if (error) goto returnError;

     

     

    returnError:

         if (result != NULL) sPSActionDescriptor->Free(result);

         if (desc00000190 != NULL) sPSActionDescriptor->Free(desc00000190);

         if (desc00000198 != NULL) sPSActionDescriptor->Free(desc00000198);

         if (list00000028 != NULL) sPSActionList->Free(list00000028);

         if (desc000001a0 != NULL) sPSActionDescriptor->Free(desc000001a0);

         return error;

    }

     
    |
    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