2 Replies Latest reply on Jul 16, 2013 3:32 AM by lhqhappy

    Hijack the Quit event from Photoshop

    Jonas

      Hi

      I am developing a Photoshop extension with CS Extension Builder.

      My problem is that the extension needs to talk to a backend server and run some scripts when Photoshop quit.

      I have tried to listen to applicationBeforeQuit, but that does not work.

       

      Does anyone know how to do this?

       

      Regards

      Jonas

        • 1. Re: Hijack the Quit event from Photoshop
          david_a_clark Adobe Employee

          In general it is not possible to delay application quit from an extension, as far as I know.

           

          I'm not 100% sure if a native PS SDK plug-in can achieve this, but I think that is your best bet. You could write a native plug-in that blocks until your extension's work is complete.

           

          Unfortunately Photoshop's ExternalInterface event listening mechanism does not seem to work in the case of quit event:

           

          private function onQuit(eventID:Number, descID:Number):void
          {
              trace ("Photoshop is quitting"); // Never gets called
          }
          
          protected function application1_creationCompleteHandler(event:FlexEvent):void
          {
              var quitEvent:int = Photoshop.app.charIDToTypeID('quit');
              CSXSInterface.instance.evalScript("PhotoshopRegisterEvent", quitEvent.toString());
              ExternalInterface.addCallback('PhotoshopCallback' + CSXSInterface.getInstance().getExtensionId(), onQuit);
          }
          
          • 2. Re: Hijack the Quit event from Photoshop
            lhqhappy Level 1

            david_a_clark 编写:

             

            In general it is not possible to delay application quit from an extension, as far as I know.

             

            I'm not 100% sure if a native PS SDK plug-in can achieve this, but I think that is your best bet. You could write a native plug-in that blocks until your extension's work is complete.

             

            Unfortunately Photoshop's ExternalInterface event listening mechanism does not seem to work in the case of quit event:

             

            private function onQuit(eventID:Number, descID:Number):void
            {
                trace ("Photoshop is quitting"); // Never gets called
            }
             
            protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                var quitEvent:int = Photoshop.app.charIDToTypeID('quit');
                CSXSInterface.instance.evalScript("PhotoshopRegisterEvent", quitEvent.toString());
                ExternalInterface.addCallback('PhotoshopCallback' + CSXSInterface.getInstance().getExtensionId(), onQuit);
            }
            

            ok  it's work now  thx your answer