2 Replies Latest reply: Jan 10, 2014 3:47 PM by zipkiev RSS

    Set active(set focus), get *aep file name, end others noobs QS?

    zipkiev Community Member

      Hi guys, need again your help  in noob questions:

      1) i find new command for AE cs6 app.activeViewer.setActive(); its set focus back to comp(to timeline with layers, after changing it to render queue when i start my script...) i  need this for my task, but it not work in cs5-5.5(((, there are alternative way(any) to set focus back to comp from RQ?

       

       

      2) how i can get name AEP file(path end others cool stuff from it) with something like app.name?

       

       

      3) i need trim png file after exporting it from AE, now i do this with "action" in photoshop and droplet with bat file, who know a bater way?, something like sent message to photoshop directly from AE?

      script on trining:

      var batFile = new File ("C:\\Users\\username\\Desktop\\test.bat");

      batFile.open("w","TEXT","????");

      batFile.writeln("C:\\Users\\username\\Desktop\\trim_droplet.exe C:\\Users\\username\\Desktop\\ltp_face1.png\r del  C:\\Users\\username\\Desktop\\test.bat");

      batFile.close();                          

      batFile.execute();

       

       

       

       

       

       

      i create bat file add to it command on lunch droplet(*droplet this exe file  from photoshop and it can run photoshop and start action from photoshop action menu) with my png file what i need to trim ,and delete bat file. i think this is the best way for now or.....?

       

       

      4) can i get version of AE(cs5 cs6 cc)?

       

       

      5) i add effect to layers but, how i can remove this effect or checking if effect already exists on layers?

       

       

      var myNull = myComp.layers.addNull(myComp.duration);

                           myNull.name="null_for_effect";

                           var nullControlProperty_m=myNull.Effects.addProperty("ADBE Slider Control");

                           nullControlProperty_m.name="effect1";

                           nullControlProperty_m.slider.setValue(1);

                           var nullControlProperty_r=myNull.Effects.addProperty("ADBE Slider Control");

                           nullControlProperty_r.name="effect2";

       

       

      i add two sliders, but if i do same script again, i have 4 effect if again 6 effect and +++

      for example i try nullControlProperty_r.remove(); and not work

       

       

      6)

      can i click for example on enable motion blur for all layers or graf editor or on live update buttons via script?

       

       

      PS Thx guys for previous help

        • 1. Re: Set active(set focus), get *aep file name, end others noobs QS?
          David Torno Community Member

          1) i find new command for AE cs6 app.activeViewer.setActive(); its set focus back to comp(to timeline with layers, after changing it to render queue when i start my script...) i  need this for my task, but it not work in cs5-5.5(((, there are alternative way(any) to set focus back to comp from RQ?

          I am unsure on this one.

           

          2) how i can get name AEP file(path end others cool stuff from it) with something like app.name?

          For future reference, you will get a lot of use out of the reflection object when looking for these kinds of answers (pg 221 JavaScript Tools Guide CC.pdf found in the ExtendScript folder under SDK folder). app.reflect.properties and app.reflect.methods will reveal a lot of options you have for the current object. So app.project.file will allow access to your current project file AEP info as long as the project is currently saved.

           

          The properties are:

          absoluteURI

          alias

          created

          creator

          displayName

          encoding

          eof

          error

          exists

          fsName

          fullName

          hidden

          length

          lineFeed

          modified

          name

          parent

          path

          readonly

          relativeURI

          type

           

          Methods:

          changePath(path)

          close()

          copy(where)

          createAlias(path)

          execute()

          getRelativeURI(baseURI)

          open(mode)

          openDlg(prompt)

          print(text)

          read(count)

          readch()

          readln()

          remove()

          rename(name)

          resolve()

          saveDlg(prompt)

          seek(pos)

          tell()

          toSource()

          toString()

          write(text)

          writeln(text)

           

          3) i need trim png file after exporting it from AE, now i do this with "action" in photoshop and droplet with bat file, who know a bater way?, something like sent message to photoshop directly from AE?

          script on trining:

          var batFile = new File ("C:\\Users\\username\\Desktop\\test.bat");

          batFile.open("w","TEXT","????");

          batFile.writeln("C:\\Users\\username\\Desktop\\trim_droplet.exe C:\\Users\\username\\Desktop\\ltp_face1.png\r del  C:\\Users\\username\\Desktop\\test.bat");

          batFile.close();                         

          batFile.execute();

           

          i create bat file add to it command on lunch droplet(*droplet this exe file  from photoshop and it can run photoshop and start action from photoshop action menu) with my png file what i need to trim ,and delete bat file. i think this is the best way for now or.....?

          Why not incorporate the resizing/cropping on the AE side. Eliminates the need for a secondary app and will speed up the process. You could create a comp template of sorts to through the png into and position it to your liking, then render out a a new png.

           

          4) can i get version of AE(cs5 cs6 cc)?

          Pg. 29 of the After-Effects-CS6-Scripting-Guide.pdf

          app.version

           

          5) i add effect to layers but, how i can remove this effect or checking if effect already exists on layers?

           

          var myNull = myComp.layers.addNull(myComp.duration);

                               myNull.name="null_for_effect";

                               var nullControlProperty_m=myNull.Effects.addProperty("ADBE Slider Control");

                               nullControlProperty_m.name="effect1";

                               nullControlProperty_m.slider.setValue(1);

                               var nullControlProperty_r=myNull.Effects.addProperty("ADBE Slider Control");

                               nullControlProperty_r.name="effect2";

           

          i add two sliders, but if i do same script again, i have 4 effect if again 6 effect and +++

          for example i try nullControlProperty_r.remove(); and not work

          You have to loop through layer effects and get the matchname or displayName that is unique (if you named the sliders specifically).

          Pg. 49 of the After-Effects-CS6-Scripting-Guide.pdf

          yourEffect.remove();     //PropertyBase object remove() method

          6) Can i click for example on enable motion blur for all layers or graf editor or on live update buttons via script?

          Pg. 56 of the After-Effects-CS6-Scripting-Guide.pdf

           

          motion blur:

               Requires a loop through all layers and then applying true/false value to layerObj.motionBlur

           

          live update:

          compItem properties include...

          activeCamera

          bgColor

          comment

          displayStartTime

          draft3d

          dropFrame

          duration

          footageMissing

          frameBlending

          frameDuration

          frameRate

          hasAudio

          hasVideo

          height

          hideShyLayers

          id

          label

          layers

          motionBlur

          motionBlurAdaptiveSampleLimit

          motionBlurSamplesPerFrame

          name

          numLayers

          parentFolder

          pixelAspect

          preserveNestedFrameRate

          preserveNestedResolution

          proxySource

          renderer

          renderers

          resolutionFactor

          selected

          selectedLayers

          selectedProperties

          shutterAngle

          shutterPhase

          time

          typeName

          useProxy

          usedIn

          width

          workAreaDuration

          workAreaStart

           

          Live update doesn't seem to be an option, you could possibly use app.executeCommand(app.findMenuCommandId("MenuCommandNameCaseSensitiveGoesHere")) if a menu command exists. I don't see one in AECC.

          • 2. Re: Set active(set focus), get *aep file name, end others noobs QS?
            zipkiev Community Member

            thx Devid for your time..,  again you help me..., i try reading more AE scripting guide and new for me(JavaScript Tools Guide), but this this guides is hard to understanding in some place, because they do  for more experiences users, maybe you recommended me another AE script programming books?? with more extended examples, because AE script guide have extended example not for every command.... ok better forgetting about this, but what i really interesting how i can crop image and delete all alpha in AE, i searched on this method more end more but always cant find solution, how i can detect alpha on image? and  now i use method with bat file, and photoshop droplet  because i can find solution...

             

            .