PseudoResources in Automation Plugin

My company has published a small automation plugin for Photoshop using the Adobe Photoshop 5.0 SDK.  It currently works on my machine (Windows 2000) using Photoshop 7.<br /><br />I'm trying to modify the plugin so that it saves some data in the current document.  The docs say that Pseudo Resources are the way to do this.  Whenever I call addProc, I get no error, but countProc and getProc act as though I haven't added anything.  Can anyone clue me in to what I've left out / done wrong in the following incantation?....<br /><br /><pre><br />#include <PIUtilities.h><br /><br />class PSPseudoResource_t : public PIUSuitePointer<ResourceProcs> {<br />   public:<br />   PSPseudoResource_t(SPBasicSuite* inSPBasic);<br />};<br /><br />PSPseudoResource_t::PSPseudoResource_t(SPBasicSuite* inSPBasic = NULL) :<br />   PIUSuitePointer <ResourceProcs> (<br />      inSPBasic,<br />      kPIResourceSuite,<br />      kPIResourceSuiteVersion<br />   ) {<br />}<br /><br />PSPseudoResource_t sPSPseudoResource(NULL);<br /><br /> *snip*<br /><br />SPAPI SPErr ENTRYPOINT(const char* const caller, <br />   const char* const selector, const void* const data) {<br />   const char* optionalSuiteIDs [] = {<br />      kPSBasicActionControlSuite,<br />      kPSChannelPortsSuite,<br />      kPIResourceSuite,<br />      NULL<br />   };<br /><br />   // This C++ object takes care of all dispatching.<br />   static PIUDispatch* dispatcher = new PIUDispatch (<br />      (char**) &optionalSuiteIDs,<br />      ADMAboutID,<br />      PIUAPI_None,<br />      Plugin::sExecute,<br />      PIUAPI_None,<br />      PIUAPI_None,<br />      PIUAPI_None,<br />      PIUAPI_None<br />   );<br /><br /> *snip*<br /><br />   #define MY_RES_TYPE 0x61746164<br />   int ret = 0;<br />   Handle h = NULL;<br />   char prbuff[1024] = "some_text";<br />   SPBasicSuite *sbs = &*sSPBasic;<br />   if (sbs != NULL) {<br />      h = sPSHandle->New(256);<br />      GlobalLock(h);<br />      strcpy(*h, prbuff);<br />      GlobalUnlock(h);<br />      PSPseudoResource_t new_sPSPseudoResource(sbs);<br />      sPSPseudoResource = new_sPSPseudoResource;<br />      // Returns 0<br />      ret = new_sPSPseudoResource->countProc(MY_RES_TYPE);<br />      if (ret == 0) {<br />         // Returns 0<br />         ret = new_sPSPseudoResource->addProc(MY_RES_TYPE, h);<br />      }<br />      // Returns 0<br />      ret = new_sPSPseudoResource->countProc(MY_RES_TYPE);<br />      // Returns NULL<br />      h = new_sPSPseudoResource->getProc(MY_RES_TYPE, 1);<br />   }<br /><br />   *snip*<br />}<br /></pre>

Try making a filter plug-in and adding your resources there. Make the filter plug-in scriptable so you can call it from your automation plug-in.

Similar Messages

  • Unable to capture startup and shutdown event of Photoshop in automation Plugin.

    Hi,
    I am creating an automation plugin and I want to register some events. I have seen listener plugin sample to register event in startup and unregister event in shutdown. I have used same code in my plugin but I am unable to capture the startup nad shutdown event of Photoshop. On clicking the menu item of my plugin the calls come inside the AutoPluginMain but during the startup or shutdown of plugin, the calls does not come inside the AutoPluginMain.
    I am unable to detect the cause of the problem. Can someone please giude me??
    Thanks in advance.

    Hi Tom,
    Thanks for the suggestion.
    Yes, I am working on Windows. As you suggested, I compiled .rc file but the compile option for .r file was disabled. After compiling the .rc file, I again rebuild the complete project and tested my build. But still I was not able to achive the desired result.
    Any other thing that I need to do to make it work?
    Thanks

  • Automation plugin as action and via File/Automate

    Hi,
    I have an Automation plugin that is scriptable (it has a number of exposed scriptable parameters and can be recorded and run from Actions palette). The plugin displayes the UI when it is called interactively (from File/Automate).
    I am however having troubles distinguishing when it is called from an Action palette as a playback of recorded action and when it actually was called interactively from File/Automate (testing it in Photoshop CS6). On plugin invocation I check passed action descriptor and if not empty, read parameters from it and don't show the UI. On the call end, I write script parameters back to a descriptor to be able to use them in recorded action. With this in mind, after PS start first time selecting File/Automate works as expected - no descriptor/parameters passed into the plugin. But after a first call, Photoshop seems to keep the descriptor/parameters written at the end of the plugin and passes it on subsequent user invoked File/Automate. The same happens if plugin is getting called from a recorded action playback (and its expected). Basically after a first invocaction, the plugin will always receive action descriptor whether it called from an action playback or invoked by user.
    I need to distinguish these two cases and basically present UI/start from scratch when user invokes it and use the passed action parameters when action plays it. I have not found anything in SDK to point me to the solution so I'd appreciate the help.
    In filter plugins I can at least get selector start when invoked from UI and use that to free/ignore the action descriptor data.

    I don't think you should care. The option you do care about is this one:
    PIDialogPlayOptions playInfo
    That is part of  PIActionParameters *actionParameters
    That is part of your PSActionsPlugInMessage that comes into your automation plugin entrypoint.
    This parameter has three options:
    a) always display the dialog,
    b) only display the dialog if you don't like the parameters you are given,
    c) never display a dialog (either return an error or proceed with best options but don't stop with a dialog)
    From the file menu, user selected, you should get option a (always). From the actions panel you should get option a or b. From scripting you can get all three options.
    There is also a property in PIProperties.h called propPlayInProgress but the above information should be what you need to do the correct thing with dialogs.

  • Automation Plugin: Problems with Shutdown/Quit on Mac

    Hi,
    I've created an automation plugin similiar to the listener-plugin example in the sdk and I'm poping up a modal dialog when receiving the shutdown message/call from photoshop. When I quit Photoshop, the dialog shows for about 1-2 secs then vanishes and photoshop crashes. On the other hand, on windows the shutdown process is halted until I dismiss the dialog by button, just as I expected from a modal dialog (and then photoshop exits normaly).
    I also tried to receive the eventQuit notification, put this event never ever seems to be sent by the host (both on win & mac).
    Any help would be greatly appreciated!
    Thanks,
    Marc

    Thanks Tom. I now use a mac os notification class to pop up my warning
    message, this works fine. However I'm still lookin for a way to receive event notifications before photoshop has handled them, something like the PreTranslateMessage method from windows/mfc. Would that be possible?
    Also, sometimes I miss some of the events, e.g. when closing a dirty document, photoshops asks if I want to save the doc, but I only receive the close-event, not the save-event. I noticed this seems to be the case with all events triggered indirectly, as the save event when closing a dirty doc or opening/closing/saving a doc from my auto-plugin.
    So my big question is, am I doing it wrong or am I trying the impossible?
    Thanks,
    Marc

  • Full path from Alias in Automation plugin

    I have an automation plugin that watches for Save events and performs some processing in CS4.
    When I do a "Save As", I've noticed that under some conditions, I can't resolve the alias in the PIActionDescriptor to a file path. Instead it resolves to the folder where the new file was saved.
    You can duplicate this using the Listener plugin by following these steps:
    1 - Open a file.
    2 - Select Save As
    3 - Select a different file format (Photoshop will change the extension. Don't edit the filename at all, let Photoshop do it.)
    4 - Select As a Copy
    5 - Save it
    Now look at the listener log file. You should see that the path is to the folder not the file.
    If you edit the file name in anyway, other than letting Photoshop change the extension, the file's path will be resolved.
    I can work around this except for the case of a Save As "As a Copy".
    Can anyone help?
    Doug

    The SourceDirectory element appears to be completely broken and has me flustered! If I specify a relative path without a '..' alias MsBuild responds with: 
    <SourceDirectory path="WebContent\bower_components"/>
    Cannot find the source directory 'C:\GitCode\Resi\ResiTrader\ResiCloudService\bin\Debug\WebContent\bower_components' in role Web.
    if I attempt to use '..' it changes the root path its resolves from!
    <SourceDirectory path="..\..\WebContent\bower_components"/>
    Cannot find the source directory 'C:\GitCode\Resi\ResiTrader\ResiCloudService\..\..\WebContent\bower_components' in role Web.
    The SourceDirectory element also does not expand environment variables unless they are SYSTEM environment variables like %PATH%. Ideally I think what customers want is the ability to pull the project down from source control and build the deployment package
    without the need for an administrator to adjust SYSTEM environment variables.

  • Suspending UI in automation plugin

    Is there a way to suspend UI during execution of automation plugin (C++ Windows, Photoshop cs5-cc). I mean updating display when plugin opens closes docs, add or remove layers.
    Cna i suspend that and resume it after execution of the plugin.
    I think that i have seen this somewhere long time a go but i can not find it now. 
    Regards,
    Momir Zecevic

    HI, I want create a dialog as your "wrong state", which i can still interact with the document when it show.
    How you create this dialog? Can you give me your code ?
    My hotmail is: [email protected]
    Thanks.

  • Modal Dialogs in Automation plugin?

    I seem to be unable to get my dialog window into a modal state when it's called as part of an Automation plugin on Windows. I've been using the very same code (wxWidgets based) from an Export plugin, and everything works fine there. Also on Mac everything is well.
    However, running that dialog from an Automation plugin, I can still interact with document windows behind my dialog. The dialog is always front, but not always the active window.
    Does anyone have any clues how event handling is different for Automation plugins, or how I could work around this?

    HI, I want create a dialog as your "wrong state", which i can still interact with the document when it show.
    How you create this dialog? Can you give me your code ?
    My hotmail is: [email protected]
    Thanks.

  • Automation Plugin in Adobe Bridge

    I've written a contact sheet automation plugin (much the same as Contact Sheet II, but allows more text fields to be included), and I'd like to get it to work from Adobe Bridge. I've included the FileBrowserAware {} in my PiPL resource block, but Bridge doesn't seem to pick up the plugin.
    TIA
    Richard,

    Bridge does not support automation plug-in types. See the scripting documentation for Bridge. The FileBrowserAware flag was for when Bridge was part of Photoshop.

  • PSPaletteMenu category doesn't work for automation plugins

    Hello,
    I would like to have a menu item under Photoshop "Window" menu for my automation plugin.
    There is a notice in the PIPL.r file that goes with SDK:
    // Use PSPaletteMenu category to add a menu item on the Window (i.e., palette) menu.
    // This is currently only enabled for automation plugins.
    PSPaletteMenu ="**Palette**";
    However when write my PiPL res like in example below
    resource 'PiPL' (ListenerResourceID, plugInName " PiPL", purgeable)
    Kind { Actions },
    Name { plugInName "..." },
    Category { "**Palette**" }, // or Category { PSPaletteMenu }
    Version { (latestActionsPlugInVersion << 16) | latestActionsPlugInSubVersion },
    menu is not shown under Window menu :(
    Want to note that if I specify Category { PSHelpMenu } it works correctly and menu item is shown under Help menu. PSPaletteMenu also doesn't work for Listener plugin that ships with PS SDK.
    Looks like plugin is not recognized as automation plugin, but I have correct info.plist props (on MacOS X version)
    What should be done to have my plugin menu item under "Window" menu?
    Regards,
    Mac Developer

    Hi Tom, thanks for your reply. Actually I'm not asking about floating palette (which I actually created and there is no issues observed). I just need my automation (!) plugin entry point to be called with kPSDoIt ("Do It") selector action after menu item is chosen under Window menu. (like it works in case PSHelpMenu)
    In the PIPL.r file that goes with SDK it states that
    // Use PSPaletteMenu category to add a menu item on the Window (i.e., palette) menu.
    // This is currently only enabled for automation plugins.
    PSPaletteMenu ="**Palette**";
    Is it documentation issue?
    Regards,
    Mac Developer

  • How to pass parameters to automation plugin to Javascript

    Hello,
    We can call automation plugin from java script below code.
    var xx = stringIDToTypeID( "459ac2e6-82d1-11d5-9879-00b0d0201111" );     // Has will be the unique ID for this plugin
    executeAction( xx, undefined, DialogModes.NO );
    I am trying to passing parameters for the same plugin.
    I tried to find a way myself following plug-in resource guide but there information is not so clear.
    Can you tell me,
    How to define parameters in terminology file. (my guess it should be define in terminology file)
    How to JS call with parameters
    And how to extract those parameters inside plugin.
    Sample Pipl.r file  (This is from C++ plugin in SDK)
    // Dictionary (scripting) resource
    resource 'aete' (16000, "Getter dictionary", purgeable)
           1, 0, english, roman, /* aete version and language specifiers */
                "Testing", /* vendor suite name */
                "Adobe example plug-ins", /* optional description */
                'get ', /* suite ID */
                1, /* suite code, must be 1 */
                1, /* suite level, must be 1 */
           { /* structure for automation */
           plugInName, /* name */
           "No comment", /* optional description */
           'get ', /* class ID, must be unique or Suite ID */
           'getr', /* event ID, must be unique */
           NO_REPLY, /* never a reply */
                IMAGE_DIRECT_PARAMETER, /* direct parameter, used by Photoshop */   <-- According to the documentation, I guess here should be come parameters.  (para name, keyID, typeID )
                { // filter or selection class here:
      {}, /* non-filter/automation plug-in class here */
      {}, /* comparison ops (not supported) */
      { // Enumerations go here:
      } /* end of any enumerations */
    // end GetterPiPL.r
    Thank you.

    Hello Mack,
    Thanks for your detail explanation.
    Actually, I haven't much play with PS javascripting plugins niter Fit image.
    The key points I have figure out that, the way you attached parameters to descriptor and point of finding some light from listener.
    That made me a conceptual idea, although I did not get all the mention facts.
    My previous guess was correct.
    Parameter should be something like below according to PiPL grammar. (in Sample Pipl.r file)
    'mymod', /* event ID, must be unique */
           NO_REPLY, /* never a reply */
                IMAGE_DIRECT_PARAMETER, /* direct parameter, used by Photoshop */ 
                "action",    /* name for parameter*/
                 keyMyPara,    /*Key parameter you have define in terminology file*/
                 typeChar,       /*parameter type*/
                 "",     /*optional description*/
                 flagsSingleParameter     /*flags */
    The UUID is enough for calling plugin, only challenge was to define parameter wtr grammar at PiPL and read it at C++ end.
    Another important fact is that we have the message pointer which points to above plug-in parameters.
    Automation plugin would give that access.

  • Make a BEEP when automator plugin completes its work

    I was wondering if there is any way to reproduce some BEEP sound when an automator plugin (eg. upload with scp) completes its work, otherwise I can't know if it really uploads the file on the server or not.

    Try the following I think it will do what you need. At the end of your workflow, after the uploading steps add one additional action. Add a "Run Applescript" Automator action. That action is built into Automator so it should be there. Replace the Words "Your Script Here" with the command beep followed by a number. Example, Beep will cause the system to beep five times.
    Instead of using Beep I tend to make the script verbally tell me when it is done. To do that use the word Say and put the phrase you want it to speak in quotes. I don't remember if you have to have enable access for assistive devices turned on or not.

  • How to delete automator plugin in finder

    Hi!
    I made an automator script, which I saved as plugin for finder. Unfortunately the script does not what it should. Now I want to remove the plugin. But I don't know how.
    Helge

    They will be in
    /Users/~/Library/Workflows/Applications/Finder

  • Zipper Noise when Automating Plugin

    Hey,
    I was just automating the Flanger-Chorus parameter on the Modulation Delay plugin and I get a strong zipper noise as the control is changing, (while audio is playing of course). It also occurs when I move the control manually, which figures.
    Is this normal or is something askew with my system. All else seems fine. Could someone try this real quick on their system?
    Thanks,
    Randall
    MDD DP 1.25 2gigorama   Mac OS X (10.3.9)   UAD-1, RME Digiface-x2

    Glad to know that things are sounding better. Mind you, I'm sure that zipper effect can come in handy somewhere. :-D
    I've seen this happen on a couple of my hardware digital delays as well, when I was adjusting the delay time. I would wager a guess that it would take more CPU resources to adjust the sample for this type of effect than it is really worth. For me, at least, I find myself adjust more than the delay. I'll probably go in and adjust the feedback and oscillators as well. By this time, I have a totally new effect. Adding to that, I'll probably want it in a different spot in the effect chain. That's when I figure it's time to instantiate another Modulation Delay.
    jord

  • Automation plugin: how to select a spot channel when 2 channels have the same name?

    I have a CMYK document opened in photoshop. In "CHANNELS" panel, I just added 2 spot colors with the same name "Sport Color 1".
    As I click any of the spot channel to select it, the "Listener" plugin will output some c++ code like below:
    SPErr PlayeventSelect(/*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 desc0000000000003980 = NULL;
         error = sPSActionDescriptor->Make(&desc0000000000003980);
         if (error) goto returnError;
              // Move this to the top of the routine!
              PIActionReference ref0000000000001A48 = NULL;
              error = sPSActionReference->Make(&ref0000000000001A48);
              if (error) goto returnError;
              error = sPSActionReference->PutName(ref0000000000001A48, classChannel, "Spot Color 1");
              if (error) goto returnError;
         error = sPSActionDescriptor->PutReference(desc0000000000003980, keyNull, ref0000000000001A48);
         if (error) goto returnError;
         error = sPSActionControl->Play(&result, eventSelect, desc0000000000003980, plugInDialogSilent);
         if (error) goto returnError;
    returnError:
         if (result != NULL) sPSActionDescriptor->Free(result);
         if (desc0000000000003980 != NULL) sPSActionDescriptor->Free(desc0000000000003980);
         if (ref0000000000001A48 != NULL) sPSActionReference->Free(ref0000000000001A48);
         return error;
    You can see "PutName" add the channel name "Spot Color 1" to reference, and I think it will not work correctly if I add such code to my project since PS cannot differentiate the 2 channels only by name. Can anyone tell me if there's any other method for selecting spot channel? Thanks in advance.

    Hi
    Here is the something from docs tht you may find usefull.
    Tryusing index instead of name:
    SPAPI OSErr(*
    PutIndex )(PIActionReference ref, DescriptorClassIDdesiredClass, uint32 value)
    Puts an index into a reference (formIndex) along with the desired class for the reference.
    Unfortunately I dont have C++ here to try i just used definition from docs.
    Hope that this help.
    Regards,
    Momir Zecevic
    Ars Media
    www.arsmedia.tv

  • Automating plugins on the master track

    i'm trying to automate the cutoff on the auto filter on the master track to i can effect the whole song. when i click on track automation i'm not seeing the master track. am i doing something wrong?

    Insert the Filter Plug In on your Stereo Outputs - right click onto the channel strip in your mixer - "create Arrange track" - draw in your nodes or record controller/mouse movements with the track set to "touch"/"latch"

Maybe you are looking for