Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all 2143 articles
Browse latest View live

Is it possible to embed images in ScriptGUI by using the ressource string method?

$
0
0

Dear script developers,

 

I’m trying to embed graphics in my UI. So far I’ve tryed the method described by Peter Kahrel in appendix 1 of his ScriptUI For Dummies, and it works for floating GUI.

But I would like to make Dockable GUI. To build the UI, I use the ressource string method that I’ve found on this forum (many thanks to David Torno) but I still can’t figure how to embed graphics in the layout.

Here is what I’ve tryed:

 

{

function myScript(thisObj) {

          function myScript_buildUI(thisObj) {

                    var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Panel Name", [0, 0, 300, 300]);

                   

var myIcon = "\u0089PNG\r\n\x1A\n\x00 etc etc"; //this is where I paste the image data

 

                    res="group{orientation:'row', alignment:['left', 'top'], alignChildren:['center', 'center'],\

                            myPanel1: Panel{text:'Panel1 Name', orientation:'column', alignChildren:['center', 'center'],\

                                                myPanelItem1: IconButton{image:'"+myIcon+"'},\

                                                },\

                                        },\

                                }"

 

                    myPanel.grp = myPanel.add(res);

                   

 

myPanel.grp.myPanel1.myPanelItem1.onClick = function(){alert('yo')};

      

                    myPanel.layout.layout(true);

                    myPanel.grp.minimumSize = myPanel.grp.size;

                    myPanel.layout.resize();

                    myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}

 

                    return myPanel;

          }

 

 

          var myScriptPal = myScript_buildUI(thisObj);

 

 

          if ((myScriptPal != null) && (myScriptPal instanceof Window)) {

                    myScriptPal.center();

                    myScriptPal.show();

                    }

          }

 

 

          myScript(this);

}

 

Is there a way to make this works or should I forget about the ressource string method to put images in my GUI?


How can i: $.evalFile (Path from the same folder inside Scripts UI)

$
0
0

Hi, actually i have a really big code and i want to $.evalFile("file.jsx"), but call from the same folder of the Script UI. But without all the ~/Desktop/Applications/AfterEffects/Scripts/ScriptUI     Path. So how can i call from there without all the extension path?????

Open and save after effect project on a network drive using Extend Script

$
0
0

Hi All,

 

Is it possible to open after effect project from a shared location of another computer and then do the modifications and save it on the same location (i.e. shared location) using Extend script?

 

Shared location path will be like below:

 

\\IP Address\\AE Projects\\ABC.aep

 

I want to open ABC.aep and then save it on the same location using Extend script (.jsx).

 

I tried different solutions but no luck.

 

Please help me out with this if anyone has done similar thing.

 

Thank you.

Folks who help look at the script where the error?Scripting?

$
0
0

I want to know why you can not ( "Slider") written to a Key property, the key is written directly (Slider), which leads to the expression can not be used!

------------------------------------------------------------------------------------------ ---------------------
1.jpg2.2.png
------------------------------------------------------------------------------------------ ---------------------
Code is as follows:

 

------------------------------------------------------------------------------------------ ---------------------

var MyComp = app.project.activeItem;

var na = MyComp.selectedLayers[0].selectedProperties[0].name;

var swings = na + "Swings - IN";

var timeOffset = na + "Offset - IN";

zuo = "\"";

var swings= "effect(" + zuo + swings + zuo + ")(Slider)";

var timeOffset = "effect(" + zuo + timeOffset + zuo + ")(Slider)";

var ft_Tb_Expression ="swings=" + swings + ";" + "timeOffset" + "=" + timeOffset + ";" + "v=valueAtTime(time-timeOffset*textIndex/textTotal)[0];anim=2*Math.PI*v/100;amp=easeOut(v ,0,100,100,0);Math.cos(anim*swings)*amp; v=valueAtTime(time-timeOffset*textIndex/textTotal)[0];anim=2*Math.PI*v/100;amp=easeOut(v, 0,100,100,0);Math.cos(anim*swings)*amp;";

if (MyComp && MyComp.selectedLayers[0].selectedProperties[0]) {

for (var i = 0;i < MyComp.selectedLayers.length; i += 1) {

var currentLayer = MyComp.selectedLayers[i];

var xpy = currentLayer.Effects.addProperty("ADBE Slider Control");

xpy.name = na + "Swings - IN";

var ypy = currentLayer.Effects.addProperty("ADBE Slider Control");

ypy.name = na + "Offset - IN";

currentLayer.effect(na + "Swings - IN")(1).setValue(1);

currentLayer.effect(na + "Offset - IN")(1).setValue(0.36);

for (var j = 0;j < currentLayer.selectedProperties.length; j += 1) {

var currentProperty = currentLayer.selectedProperties[j];

if (currentProperty.canSetExpression) {

currentProperty.expression = ft_Tb_Expression;

} else {

alert("Select this property can not create expressions!!!!!!");

}

}

}

} else {

alert("Please select a layer of a property");

}

------------------------------------------------------------------------

thank you!!!!

 

 

ae memu

$
0
0

Hello,

 

 

How can I get to the "trim comp to work area" order through the "extendScript toolkit" tool?

ExtendScript If Else (else not working)

$
0
0

Hello all, my first post and hoping you can help!

 

To help with my ExtendScript learning I've been writing a script for a trim paths function. Almost there but the else part of my if else statement isn't working.

 

I've simplified it down to this: Check whether there is already a trim path property on selected layer. If yes, get a confirmation before deleting and adding another. If no, add a new one.

 

 

var curLayer = app.project.activeItem.selectedLayers;
var shapeLayerContents = curLayer[0].property("Contents");
var existingTrimPath = shapeLayerContents.property("ADBE Vector Filter - Trim");


// CHECK FOR EXISTING TRIM PATH
if (shapeLayerContents = shapeLayerContents.property("ADBE Vector Filter - Trim")) {


    var check = confirm("TrimPaths already exist! Remove and continue?",true);                if(check == true){                                   // DELETE EXISTING TRIM PATH                 existingTrimPath.remove();                // ADD NEW TRIM PATH                var curLayer = app.project.activeItem.selectedLayers;                var shapeLayerContents = curLayer[0].property("Contents");                var trimPath = shapeLayerContents.addProperty("ADBE Vector Filter - Trim");                              } else {                trimPath;                 }
}

 

Tried every possible combination I can think of, but no avail. Any help would be really appreciated! Thanks!

 

James

Progress Bar to show the comp render progress

$
0
0

Hi everyone and as always, thank you in advance for all your help!

 

I wanted to learn more about how to use the Progress Bar in Extend Script, So I created a user interface that allows me to render the current project, and similar to the AE render queue, I would like to also include a Progress Bar to my GUI Window that replicates the progress bar from the render queue. Attached is a picture of the window I created. What I am not sure of is how to connect the Progress bar to the current comp being rendered...

 

In the actual AE Render Queue, when you click to render a comp, it uses the progress bar based on the initial comp frame, end frame of comp and current frame..., So, I went into the AE Scripting guide and I looked into the renderQueue attributes and I was not able to find an attribute for the current frame being rendered, so thought maybe if I use the comp.time, work Area Start and End might get me somewhere... but then I noticed that the progress bar will not run simultaneously with the render... it will wait till the render finishes and then run the progress bar... anyways, not sure how to accomplish this...

Screen Shot 2016-05-10 at 3.09.14 PM.png

 

// This is what I started coding to test the progress bar while also trying to render simultaneously.... but does not work it finishes rendering and then runs the progress bar...

bttn_s5Group3_doRender.onClick = function(){

        rd_RenderLayers_doRenderLayers(true);      //This function is used to render the comp, I also tried putting this while loop inside the function, but same results.

        while(progressBar.value < progressBar.maxvalue)    //Dummy Progress Bar.

       {

              progressBar.value++;

              $.sleep(10);

       }

}

 

 

// This is what I was coding trying to get the Progress Bar to show current frame being rendered... but also, does not work... Obviously, I have no idea what Im doing.

var compToRender = app.project.renderQueue.item(i).comp;

var compToRenderCurrTime = compToRender.time;

var compToRenderStart = compToRender.workAreaStart;

var compToRenderDur = compToRender.workAreaDuration;

var compToRenderEnd = compToRender.workAreaDuration + compToRender.workAreaStart;

 

bttn_s5Group3_doRender.onClick = function(){

        while(progressBar.value < progressBar.maxvalue)

        {

                compToRenderStart = progressBar.minvalue

                progressBar.maxvalue = compToRenderEnd;

                progressBar.value = compToRenderCurrTime;

                myWin.update();

        };

        rd_RenderLayers_doRenderLayers(true); // This function renders

};

 

 

Once again, thank your help!

 

Fabio

BG Renderer AE CC "Unable to obtain a license..."

$
0
0

Hi, my BG renderer plugin keeps getting this error: "Unable to obtain a license. Please run the full application to correct the problem or get a more detailed message." I have tried reinstalling After Effects CC 2015 twice as well as removing and replacing the script, but it still doesn't work.

 

I have contacted the author of the plugin and he said it's not a problem with the plugin but with Adobe's Creative Cloud licensing. Looking through the comments on the plugin's website I'm also not the first to experience this problem and the author's reply to that problem was the same in the past. So I assume this has been solved before from Adobe's side.

 

After contacting Adobe's Customer Care and having someone do a Remote Support, he couldn't find a solution as well. Does anyone have any suggestions or know how to fix this?

 

BG Renderer Error.jpg


Free Function Friday Episode List

$
0
0

Hey all, just wanted to create a single thread to list out episodes as they are released. I've have a single full collection post on ProVideo Coalition later down the line when there are enough episodes out as well.

 

EP 1

getLayerEffects

 

EP 2

runMenuCmd

 

EP 3

aeToOSFolder

dropdown interaction issue...

$
0
0

Hi guys,

 

I have a composition with 48 layers, and I decided to separate them all in four groups of 12 layers each depending on its properties (with or without logo or bar)... See image attached.

 

 

Anyways, the dropdowns works good, when I select an item of one of the dropdowns, it makes that one layer visible and disable all the other layers...

 

Where I am having problems is, I want my user interface to only show the selected layer within the dropdown and have the other three dropdowns show blank or dd.selection=0.

 

So I added to each dropdown the following:

 

//SELECT DROPDOWN A

ddA.onChange = function() {

     ddB.selection = 0; //I also tried changing 0 for null; and same problem.

     ddC.selection = 0;

     ddD.selection = 0;

 

     Additional code...

};

 

//SELECT DROPDOWN B

ddB.onChange = function() {

     ddA.selection = 0; //I also tried changing 0 for null; and same problem.

     ddC.selection = 0;

     ddD.selection = 0;

 

     Additional code...

};

 

//SELECT DROPDOWN C

ddC.onChange = function() {

     ddA.selection = 0; //I also tried changing 0 for null; and same problem.

     ddB.selection = 0;

     ddD.selection = 0;

 

     Additional code...

};

 

//SELECT DROPDOWN D

ddD.onChange = function() {

     ddA.selection = 0; //I also tried changing 0 for null; and same problem.

     ddB.selection = 0;

     ddC.selection = 0;

 

     Additional code...

};

 

The problem is that it is not just changing the selection on my GUI, but is triggering the other three dropdowns .onChange event, even if I am not using notify() which causes the dropdowns to conflict between all of them. Is there a way to tell it that when the user selects one option from one of the dropdowns to make the other dropdown to show the first item on their list which is " " without triggering the .onChange of the additional dropdowns?

 

Thanks in advance for the help!

 

Fabio

How to get rid of the "Starting Composition" scripting alert?

$
0
0

Hi,

 

I'm trying to use a script to render a composition from AE project from the command line, but each time I keep getting the modal dialog like this:

AE doesn't start rendering, until I hit OK, and I have no idea how to make this warning go away.

 

Any ideas?

How to change the label color of a Affter Effects Render Queue Item in javascript

$
0
0

Hi,

 

Is there a way to change the label color of a Render Queue Item in javascript?

For other items in project, label attribute is for the label color, but seems like Render Queue item doesn't have label attribute.

After Effects is all about the keys, baby–so why isn't there an object to represent them?

$
0
0

Why isn't there a keyframe object in the After Effects object model? The hierarchy stops at property, and I can't understand why.

 

This means if I am trying to reference an attribute of an individual keyframe I have to use an index in a function like

app.project.item(index).layer(index).propertySpec.keyInInterpolationType(keyIndex)

 

But that only returns the value, it doesn't give me access to the actual keyframe property. Also, if I'm doing operations that change the number of keyframes in a property this gets very convoluted.

 

Wouldn't it be easier if we could go:

var keys = app.project.item(index).layer.propertySpec.getKeys()

for (i =0; i< keys.length; i++){

     keys[i].keyInterpolationType=something;

}

and have direct access to the attributes of the key? It means you could pass a keyframe to another function directly without having to pass it the property and then the index of the key you want.

 

I'd love to hear from the Adobe people why they made this call.

Un-Serialising data from a file, without eval

$
0
0

I'm playing with writing data to a file so that it can persist between sessions. I'm using

f.write(data.toSource());

to save my data, where f is my file object, and

var data = eval(f.read());

to get the data back from the file. But that seems like a very insecure way of doing things. Sure it's unlikely that anyone is going to use, AEscript preference files as a backdoor, but that's still just security through obscurity.

 

Is there a way to read serialised data from a file without using eval()? Or do I have to roll-my-own parser / serialiser to do it safely?

Is there a way to save animation preset by script?

$
0
0

Hello,

    I have written a script named Memory,which save any layers even comp layer for later generating.https://github.com/Smallpath/Memory

    A few days ago,I completed the preview feature,and was ready to release it with v3.0 tag.However,script can't get or set the value of special plugins such as Curve,Particular and Puppet,nor do my script Memory.I know these plugins can be saved as animation preset by click in Ae,but that needs the user to click, select the folder,input the preset name and finally click OK,which is not I what.

   I really what to improve my script.Therefore,I wonder if there is a way to save animation preset by script.Maybe it can be a hidden method such as CompItem.saveFrameToPng.Thanks for any help


Creating portable psuedo-effects for AfterEffects

$
0
0

Hi There,

 

I have some scripts that rely on a bunch of different expressions controls.  I wanted to know if there was a more organized way of creating a preset that included all of the expressions and their default values.  I found the video tutorial over at batchframe where the Jesse Toula explains the method of modifying an .xml to create pseudo effects.  Is there a way to create pseudo effects without having to touch the .xml file?  I'd like for the preset effect to be as portable as possible.  The batchframe tutorial makes it clear that if the .xml file does not contain a declaration of the effect, and the preset is applied, it will prefix the preset with "Missing".  Is there any way to avoid this?

 

Thanks!

executeCommand("Shy") to specific Layer and Refresh Preview cache

$
0
0

Hi,

 

Im actually doing a button to execute command to Shy an specific layer called:  app.project.item(1).layer("Pos").property("Position")

 

And then refresh the Preview green bar at the top of timeline. Because after effects CC 2015 always trying to save some cache in that green line, and i dont want it, so i need a command or something in javascript to refresh that green bar.

 

For the Shy Command is here :      app.executeCommand(app.findMenuCommandId("Shy"))

 

But how to apply the shy command in my specific layer???? and then refresh preview????

 

(I dont need the Button Panel) Just the lines of code of my question.

 

Thank you in advance

Adding Pseudo Effect Without Restarting

$
0
0

The "standard" way of creating pseudo effects (sometimes called custom controls) is to edit the Preset Effects.xml file, but it seems there's a way to add custom controls without doing that (at least in AE CC 2015).

 

Is there a way to load the XML right into the effect via scripting? Something like:

 

var pseudoEffect = <Effect matchname="Pseudo/CUSTOMEFFECT" name="$$$/AE/Preset/CUSTOMEFFECT=CUSTOMEFFECT">

    <Group name="$$$/AE/Preset/1=1">

        <Slider name="$$$/AE/Preset/2=2" default="0" valid_min="-100" valid_max="100" slider_min="0" slider_max="100" precision="1"/>

        <Slider name="$$$/AE/Preset/3=3" default="0" valid_min="-100" valid_max="100" slider_min="0" slider_max="100" precision="1"/>

    </Group>

</Effect>;

 

app.project.activeItem.layer(1).effect.addProperty(pseudoEffect);

 

Or is there a way to create an FFX file via scripting, and load that into the effect?

Tooltip on a dockable GUI

$
0
0

Hi everyone,

 

I just created au dockable GUI with pictos (not text) and for my users, I would like to have a tooltip on the Mouse rollover to show the name of every function.

 

Here is my menu

 

{

function myScript(thisObj) {

     function myScript_buildUI(thisObj) {

          var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Menu Pitchy", undefined, {resizeable:true});

          res="group{orientation:'column',\

               myPanel1: Panel{text:'Mises à jour', orientation:'row',\

                    myButton01: IconButton{text:'Mise à jour complète', tooltipActive:'Mise à jour complète', image:'D:/PITCHY/Scripts/Images/All.png'},\

                    myButton02: IconButton{text:'Vidéo', image:'D:/PITCHY/Scripts/Images/Video.png'},\

                    myButton03: IconButton{text:'Lignes Text', image:'D:/PITCHY/Scripts/Images/Lignes.png'},\

                    myButton04: IconButton{text:'Info Séquence', image:'D:/PITCHY/Scripts/Images/Info.png'},\

               },\

               myPanel2: Panel{text:'Débug', orientation:'row',\

                    myButton05: IconButton{text:'Layer Style', image:'D:/PITCHY/Scripts/Images/Layer.png'},\

                    myButton06: IconButton{text:'Disable Null', image:'D:/PITCHY/Scripts/Images/Null.png'},\

                    myButton07: IconButton{text:'Code Camembert', image:'D:/PITCHY/Scripts/Images/Codecam.png'},\

                    myButton08: IconButton{text:'Code Position line1', image:'D:/PITCHY/Scripts/Images/Posline.png'},\

               },\

               myPanel3: Panel{text:'Réglages', orientation:'row',\

                    myButton09: IconButton{text:'Rescale Bloc', image:'D:/PITCHY/Scripts/Images/Rbloc.png'},\

                    myButton10: IconButton{text:'Rescale Ligne', image:'D:/PITCHY/Scripts/Images/Rligne.png'},\

                    myButton11: IconButton{text:'Polices', image:'D:/PITCHY/Scripts/Images/Polices.png'},\

               },\

               myPanel4: Panel{text:'Tests', orientation:'row',\

                    myButton12: IconButton{text:'Text 40 car.', image:'D:/PITCHY/Scripts/Images/T40.png'},\

                    myButton13: IconButton{text:'Text 120 car.', image:'D:/PITCHY/Scripts/Images/T120.png'},\

                    myButton14: IconButton{text:'Time Stretch', image:'D:/PITCHY/Scripts/Images/Time.png'},\

               },\

          }";

 

          myPanel.grp = myPanel.add(res);

         

          /*---- My buttons settings ----*/

          return myPanel; }

    

     var myScriptPal = myScript_buildUI(thisObj);

    

     if(myScriptPal != null && myScriptPal instanceof Window)

     { myScriptPal.center(); myScriptPal.show(); }

}

 

myScript(this);

}

ExtendScript handling special characters

$
0
0

Hello,

 

I am working on my first script for After Effects. I have never worked with JavaScript so please bare with me if the answer to my question is very simple.

 

I am simply reading a .txt file and parsing the strings into variables. I am then taking these variables and using the strings to populate text layers in After Effects. Everything is working perfectly besides that it will not populate "special characters" from the Spanish language. How do I get JavaScript to allow these characters to be populated into the text layers?

 

Here is my code:

 

///MAIN FUNCTION  

var newFile = File.openDialog("Choose file to read.");

 

 

if (newFile != null){

    var  a = readDocument(newFile , 1).contentAry;

   

        replaceText(a);

 

 

}

 

 

/// Checks if document exists --> if yes, creates new array and populates from file

function readDocument(inputDoc , linesToSkip){

    var curDoc = new File(inputDoc);

   

    if(curDoc.exists){

        var contentAry = new Array();

       

        curDoc.open("r");

       

        ///populates until the end of the txt file

        while(!curDoc.eof){

            contentAry[contentAry.length] = curDoc.readln();

        }

           

        curDoc.close();

 

 

    }

 

 

    /// Replaces the array's normal spacing character

    contentAry.splice(0, linesToSkip);

    var contentList = contentAry.join("_gap_").toString().replace(new RegExp("_gap_" , "g"), "\r");

    contentAry = contentAry;

   

    return{

        'contentAry': contentAry,

        'contentList': contentList

     }  

       

}

 

 

 

 

/// Function to replace text in layer

function replaceText(content){

   

    try{

        ///variables for the specific layers that are being targeted

            var  layerOneA = app.project.item(3).layer(1);

            var  layerTwoA = app.project.item(3).layer(2);

            var  layerThreeA = app.project.item(3).layer(3);

            var  layerOneB = app.project.item(4).layer(1);

            var  layerTwoB = app.project.item(4).layer(2);

           

           

         ///checks that the parameter being passed through the function is an array  

        if(content instanceof Array){

            var  curLine , lineOne , lineTwo , lineThree, lineFour, pl;

            var  aryLength = content.length;

 

 

            ///iterates through the array & parses its data to variables

            for(var i=0; i < aryLength; i++){

                curLine = content[i];

                pl = parse(curLine);

                lineOne = pl.title;

                lineTwo = pl.msg;

                lineThree = pl.tune;

                lineFour = pl.name;

               

                ///Used another for loop so the function works on the main compositions (everything is nested from these comps)

                for( var x = 0; x < 2; x++){

                    if(x == 0){

                        layerOneA.sourceText.setValue(lineOne);

                        layerTwoA.sourceText.setValue(lineTwo);

                        layerThreeA.sourceText.setValue(lineThree);

                    } else {

                        layerOneB.sourceText.setValue(lineOne);

                        layerTwoB.sourceText.setValue(lineThree);

                    }

                }

              docName.name.setValue(lineFour);

              alert(docName.name);

             }

        } 

    }catch(err){alert(err.line.toString() + "\r" + err.toString())};

}

               

       

 

 

 

 

 

 

/// Splits the array's strings into seperate objects

function parse(myText){

    while(!myText.eof) {

        var  t = myText.split("\t");

 

          return{

             'title' : t[0],

             'msg' : t[2],

             'tune' : t[3],

             'name' : t[4]

          }

     }

}

 

 

 

Thank you for your help!

Viewing all 2143 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>