2 Replies Latest reply on May 25, 2010 10:08 AM by habaki1

    How to link an event and a script ?

    habaki1 Level 1

      Hello !

       

      This event manager is not easy to deal with !

       

      I need to link several events to a script by script.

       

      For this command by hand, the script listener says : 

       

      // =======================================================
      var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );

      var desc56 = new ActionDescriptor();
      var idjsNm = charIDToTypeID( "jsNm" );
      desc56.putString( idjsNm, "Gestionnaire d'événements de script..." );
      var idjsMs = charIDToTypeID( "jsMs" );
      desc56.putString( idjsMs, "1" );
      executeAction( idAdobeScriptAutomationScripts, desc56, DialogModes.NO );

       

      (French version)

       

       

       

      where the single parameter is "1".

      It is the number assigned to the script file inside a .XML file in the "Adobe potoshop CS4 setting" folder in the user file space.

      But where is the event parameter ? (it was "select" in this case)

       

      In fact this command clandestinely links the event name and the file full path into the TW0001.DAT file inside th esame folder. Fine !

      But modifying this file outside PS does not change the links into PS: so it is also recorded in memory.

      How to synchronize this data by script ?

       

      After many and many tests to guess how to program the event manager, I hope somebody knows this final answer.  

       

      Thank you for you help.

        • 1. Re: How to link an event and a script ?
          Michael L Hale Level 5

          Both the Script Event Manager and app.notifiers.add require the full path to a javascript file and don't accept arguments for the script. I am not sure what you are trying to do. You could have the script read the needed arguments from somewhere like an text or xml file or even CustomOptions.

           

          If you want the event to call one of several scripts depending on the arguments then after the argument is read you could have if or switch statements to eval the needed scripts.

          1 person found this helpful
          • 2. Re: How to link an event and a script ?
            habaki1 Level 1

            Thank you Michael !

             

            I am now so in the habit of getting a code from the scriptlistener because it is not available with objects that i completely forgot app.notifiers.

            But in fact the scriptlistener is not helpfull to do what app.notifiers.add does, and it is a little bit strange. Nothing is perfect !

             

            Sorry for my useless question.