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

Script UI layer selection not updating after restarting AE

$
0
0

I am making a dockable UI and I have two StaticText objects in my UI where I display certain information and one of them is number of selected layers.

I also have a refresh button that updates their text values.

 

When I restart or open another project while the script is docked it doesn't recognize any kind of layer selections. I have to close the script and open it again for the selection to work.

 

 function curios_buildUI(thisObj)    {        var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Curios Name Changer", undefined, {resizeable:true});        res = "group{orientation:'column',  alignment:['fill','center'], alignChildren:['fill','fill'],\                groupOne: Group{orientation:'row',\                staticText1: StaticText{text: 'Imported: 0', characters: 12},\                staticText2: StaticText{text: 'Selected: 0', characters: 11},\                },\                groupTwo: Group{orientation:'row',\                button1: Button{text: 'Import'},\                button2: Button{text: 'Execute'},\                },\                groupThree: Group{orientation:'row',\                button3: Button{text: 'Refresh'},\                button4: Button{text: 'Help?'},\                },\            }";               myPanel.grp = myPanel.add(res);               //Defaults        myPanel.grp.groupOne.staticText1.text = "Imported: " + 0;        myPanel.grp.groupOne.staticText2.text = "Selected: " + 0;        updateTexts();               //Sizing        myPanel.layout.layout(true);        myPanel.grp.minimumSize = myPanel.grp.size;               myPanel.layout.resize();        myPanel.onResizing = myPanel.onResize = function()        {            this.layout.resize();        }                            myPanel.grp.groupThree.button3.onClick = function()        {            updateTexts();        }                   function updateTexts()        {            var select;            try            {                select = mainComp.selectedLayers;            }            catch (e) {}                                  myPanel.grp.groupOne.staticText1.text = "Imported: " + names.length;            if(select != null)                myPanel.grp.groupOne.staticText2.text = "Selected: " + select.length;            else                myPanel.grp.groupOne.staticText2.text = "Selected: " + 0;        }        myPanel.layout.layout(true);        return myPanel;    }

Unable to create temporary image error

$
0
0

Hi there, I recently started embedding images in my scripts...

Today for some reason, AFX doesn't like loading any scripts with embedded graphics...

"Unable to load temporary image file" is the message I am getting.

 

and the script crashes...  restarted, AFX, ESTK and pc ... same deal.

 

Any idea what is causing the conflict....?

 

 

Thanks

Alan.

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?

Real keyframes speed and influence of spatial properties

$
0
0

I’m writing a script that exports layer properties based on their keyframes to animate on html.

There are 3 different groups of properties and each takes a different calculation.


PropertyValueType.COLOR,ThreeD,TwoD,OneD

This is the easiest. For each dimension I get the averageSpeed. And then I calculate the control points of the easing curve.

averageSpeed[index] =  (endKey.value[index] - initKey.value[index])/duration;

bezierIn.x[index] = 1 - item.influence / 100;

bezierOut.x[index] = initKey.easeOut[index].influence / 100;

bezierIn.y[index] = 1 - ((item.speed) / averageSpeed[index]) * (item.influence / 100);

bezierOut.y[index] = ((initKey.easeOut[index].speed) / averageSpeed[index]) * bezierOut.x[index];


PropertyValueType.ThreeD_Spatial,TwoD_Spatial

For these spatial properties, to get the average speed I need to get first the spatial distance of the curve, and then it’s similar to the case before.


averageSpeed = getCurveLength(initKey.value,endKey.value, initKey.tangentOut, endKey.tangentIn)/duration;

bezierIn.x = 1 - endKey.easeIn.influence / 100;

bezierOut.x = initKey.easeOut.influence / 100;

bezierIn.y =  1 - ((endKey.easeIn.speed) / averageSpeed) * (endKey.easeIn.influence / 100);

bezierOut.y = ((initKey.easeOut.speed) / averageSpeed) * bezierOut.x;


PropertyValueType.SHAPE

Shape is the same as the previous one, only that average speed is always 1.


All of them work fine in common cases. But for spatial properties, After Effects reports the influence incorrectly in some cases.

It seems the influence is intentionally limited so the speed won’t get negative values along the path.

I don’t understand exactly how the influence is limited but the property´s keyInTemporalEase and keyOutTemporalEase still reports the value set by the user and not the limited value.

I need to get the actual value so I can replicate the animation correctly when I export it.


Does anyone have any idea how to get the real value of the influence property? Am I understanding what is going on correctly?

Here´s a graph that shows the curve when the influence is limited.

graph.jpg

convert Ae keyframes info to cubicbezier points

$
0
0

hey guys does anyone know how to convert the influence and speed of keyframes into cubic-bezier points? just wondering if there was a formula.

save project with files included at a new location using ExtendScript

$
0
0

Can you save project with used files at some location without being interrupted by the dialog "..chose folder name and location..." using ExtendScript?

 

Kinda like

 

File->Dependencies-> Collect Files -> For Selected comps

 

but without being asked to choose folder.

 

There was a similar question asked 2 years ago and was never marked as answered.  I wonder if it is now, in 2017, possible to accomplish the task I explained above.

how to write resource string base IconButton

$
0
0

leftPart:Group{\

  orientation:'column',alignment:['fill','fill'],\

  txtArea:EditText {text:'', properties:{'multiline':true}, alignment:['fill','fill'], minimumSize:[300,0]},\

  buttonGrop:Group {\

  orientation:'row',alignment:['fill','bottom'],\

  import:IconButton{size:[30,20],alignment:['left','bottom']},\

  } \

 

i want to let the IconButton to show an image

 

how should i edit the script?

Slider with round handle/knob

$
0
0

Hi

 

I sometimes see panels with sliders with round handles instead of the eight sided ones I always get.

 

Can't figure it out. Is that a property on the slider?

 

Thanks,

Jakob


Implicit setters and getters

$
0
0

Hi

 

This might be more a javascript syntax question, but here goes:

 

I create a object def like this:

 

function MyObjectDef()

{

    this.initialize();

};

 

MyObjectDef.prototype.initialize = function()

{

    this.a = 10;

}

 

var mo = new MyObjectDef();

alert(mo.a);

 

Question is, how do I create an implicit setter for that object? I know I could do this:

 

MyObjectDef.prototype.setA = function(v)

{

    this.a = v*2;

}

mo.setA(10);

alert(mo.a); // would return 20

 

But I would much prefer something like this (which obviously doesn't work):

 

 

MyObjectDef.prototype.set a = function(v)

{

    this.a = v*2;

}

mo.a = 10;

alert(mo.a); // would return 20

 

Any help?

 

Thanks,

Jakob

Adding flashplayer in UI Panel on Mac

$
0
0

Hello,

 

I'm getting an error on mac when adding a flash player in Panel UI as below:

 

var flashPlayer = palleteObj.add("flashplayer");

 

Unable to execute script on line 1. Uncaught exception add.

 

Does anyone had a similar problem. Is there any way to resolve this?

 

Thanks,

Codrin

why editText in different background color ?

$
0
0

editText with multline : true ,its background color is white;

editText with multline : false,its background color is black;

 

 

so somebody can explain this?

 

and one more question:

when the ScriptUI version of Ae will update ?

extendScript's ScriptUI version is 6.2.2 and Ae's 6.1.8

System is Undefined

$
0
0

I've been working with ExtendScript Toolkit CC and up until today my calls to system.callSystem() were working fine. I've changed nothing, but suddenly today these calls (and any other calls to System object methods) are failing with 'System is Undefined' errors. I'm on latest MacOS, and CC 2017. Any ideas? Thanks.

scripting - creating button by loop

$
0
0

Hello all JS guru´s. I would like to find a way how to build ui by loop.

 

I created a buttons by loop and I dont know how to call their own functions. Buttons are in array.. but when i click on some of them there are on .onClick function.

I need give function to every button and .onClick must bu functional ... i dont know how.

 

 

 

 

Let me explain this concrete:

 

 

I have code:

 

 

<code>

var mainWin = new Window ("palette","aaa",undefined);

var groupOne = mainWin.add("group",undefined,"grupa jedna");

groupOne.add("statictext", undefined, "XXX");

 

 

var groupTwo = mainWin.add("panel", undefined, "yyy");

groupTwo.orientation = "row";

var but =[];

for (var i = 1 ; i&lt;= 6; i++)

{

  

    but[i] =groupTwo.add("button", [undefined,undefined,100+i,100], "buut" + " " + i );

    but[i].onClick = function ()

 

    {

        alert ("button ID...show [i] somehow");/// there i need somethink to remember button ID

 

 

    }

 

 

  

}

alert (but[3].size);  //controll alert for button number

 

 

mainWin.show();

</code>

How to change size and color of "staticText"??

$
0
0

Can someone plz share how to change size and color of "staticText" object??

 

 

 

function buildUI(thisObj) {

 

var myPanel = (thisObj instanceof Panel) ? thisObj:new Window('palette', 'Stress Reducers',undefined, {resizable: true});

 

var txt=myPanel.add("staticText",[0,0,100,20],"txt");

 

//txt. newFont, fontSize,color?????

 

 

  return myPanel;

 

}

 

 

var myToolsPanel = buildUI(this);

quit then relaunch AE with script

$
0
0

hi people

 

Would anyone know how to quit and then relaunch After Effects using a script. I've tried most everything I can think of including using BridgeTalk from within ESTK but I can't get anything to work.

 

basically what I need to do is launch AE, open a project, render what's in the queue, quit After effects, and then repeat...  I can manage to get it all happening except for the application launch.

 

any suggestions greatly appreciated.


extend script ae version is 14.0

$
0
0

and the current version of ae is 14.1

Expression Problem: single & double Number

$
0
0

Good evening guys!

 

Can someone tell me about this problem?

 

Problem.jpg

 

 

The logic is when I write the number automatically display first the Surname and after the Νame. When I check the Checkbox Control, display reverse fisrt the Name and then the Surname.

 

When the numbers are double (10, 20, 30) all is ok!

 

When the number is single (1,2,3,4), the algorithmn in the number 1 works ok.

when I write 2, shows the number 1 with the name and surname reverse!!!

And from there on, the algorithm is one step back with the Surname and the Name reverse.

I write 3, shows the 2 reverse

I write 4 displays 3 reverse...

 

Thanks you all

John K.

 

 

 

I have this expression:

 

A = parseInt(text.sourceText);

a1 = parseInt(comp("2.2 Team 2 Data").layer("No 1").text.sourceText);

a2 = parseInt(comp("2.2 Team 2 Data").layer("No 2").text.sourceText);

a3 = parseInt(comp("2.2 Team 2 Data").layer("No 3").text.sourceText);

a4 = parseInt(comp("2.2 Team 2 Data").layer("No 4").text.sourceText);

 

 

if(A==a1 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==0)) comp("2.2 Team 2 Data").layer("No 1").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 1 Surname").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 1 Name").text.sourceText;

 

 

else if(A==a1 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==1)) comp("2.2 Team 2 Data").layer("No 1").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 1 Name").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 1 Surname").text.sourceText;

 

 

else if(A==a2 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==0)) comp("2.2 Team 2 Data").layer("No 2").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 2 Surname").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 2 Name").text.sourceText;

 

 

else if(A==a2 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==1)) comp("2.2 Team 2 Data").layer("No 2").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 2 Name").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 2 Surname").text.sourceText;

 

 

else if(A==a3 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==0)) comp("2.2 Team 2 Data").layer("No 3").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 3 Surname").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 3 Name").text.sourceText;

 

 

else if(A==a3 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==1)) comp("2.2 Team 2 Data").layer("No 3").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 3 Name").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 3 Surname").text.sourceText;

 

 

else if(A==a4 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==0)) comp("2.2 Team 2 Data").layer("No 4").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 4 Surname").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 4 Name").text.sourceText;

 

 

else if(A==a4 + (comp("1.2 Team 1 Data").layer("Name Controller").effect("Change Name <> Surname")("Checkbox")==1)) comp("2.2 Team 2 Data").layer("No 4").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 4 Name").text.sourceText + "  " + comp("2.2 Team 2 Data").layer("Player 4 Surname").text.sourceText;

 

else text.sourceText

Why can not I read the color values of Gradient Fill or Stroke in the after effects script?

$
0
0

I am trying to read the "Colors" property values of "Gradient Fill" or "Gradient Stroke" property. It gives me the following error.

 

After Effects error: Can not get or set a value from this property (matchname is “ADBE Vector Grad Colors”). This property’s propertyValueType is PropertyValueType.NO_VALUE.

 

I have encountered Can`t access to gradient colors in shape this thread.

Can anyone please explain any work around to get the values?

RegExp bug ?

$
0
0

Hello,

 

it's drive me crazy...

I'm have test this sample code with node.js, in a developper console (firefox), in ExtenSript Toolkit and in AfterEffects:

 

var reg = new RegExp("^(?!.*auto-save).*aep$");

var string1 = "Comp.aep"

var string2 = "Comp auto-save.aep"

alert(reg.test(string1)+ " "+ reg.test(string2));

 

What i want is find "aep" in a string but exclude "auto-save"; easy...no?

All javascript engines return correct result ("true false") but not ExtendSript nor AfterEffects ("true true").

 

 

Reading float values from binary file

$
0
0

Hi all,
I have a binary file containing data recorded using a c program.
the data stored in files are float values.
Now I need  to retrieve the float numbers from binary file in after effects script.

 

This is my code:

var myFile =File.openDialog('select file');
myFile.open("r");
myFile.encoding ="binary";
for(x=0;x<myFile.length;x +=4){
     myFile.seek(x,0);
     buffer = myFile.read(4);
     ???
}

 

the question is how to convert the buffer to a float number?

Viewing all 2143 articles
Browse latest View live


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