2 Replies Latest reply: Feb 24, 2014 10:33 PM by elevenmediadev RSS

    "Copy and Paste"-Event in Indesign


      Hi everyone,


      does anyone have an idea, if there is SOMEWHERE an event, which is fired upon "copy and paste"-ing one or multiple object in Indesign?

        • 1. Re: "Copy and Paste"-Event in Indesign
          elevenmediadev Community Member

          Okay, since no one seems to answer in this forum anymore and I hope to help someone else wo might look for this problem in the future, here is a solution:


          Normally, all your events/eventlisteners have to target "a File or a JavaScript", which is pretty worthless, since we are in an ActionScript environment. The MIGHT be a fancy way to create a meaningfull workflow for this, but since all documentations, tutorials, cookbooks etc. on this have vanished into oblivion, here is what you should do.


          - Check if the source of the Event is a child of CSHostObject. If not, you might have a problem

          - Let´s pretend it is, then use the IDScriptingEventAdapter to catch your events. Here is an example which works for me to detect if a "Paste" happens



          private function pluginComplete():void{
               // in my project, this function is called once the plugin has been initialized. 
               // the ID 271 is for "Paste". If you need another one, you might need to fiddle around with the items within the menuActions-Object
               IDScriptingEventAdapter.getInstance().addEventListenerToObject(MenuAction.AFTER_INVOKE, menuActionHandler, InDesign.app.menuActions.itemByID(271));
          private function menuActionHandler(e:*):void{
            trace("AN EVENT !!!", e)
          • 2. Re: "Copy and Paste"-Event in Indesign
            elevenmediadev Community Member

            A small addition: Under http://www.kahrel.plus.com/indesign/menu_actions.html you can find a helpfull script, which lists all MenuAction and their ID, so that you can apply my above solution to other actions