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

Cant open the CEP Extension in After Effects CC2015

$
0
0

I can see the extension at windows->extension, but if I click it, it cant be opened.

I guess, there must be some param set wrong. Any help is also very grateful.


"Reading past end of file" Trying to apply Preset from Script

$
0
0

I'm creating my first AE Script and have run into a small problem. I wish to apply a Preset to a Layer but i keep getting an ERROR/Warning message pop-up "After Effects warning: Reading pas end of file". I wantto apply the preset Gaussian Blur although i've tested toehr presets and still the same result. bandicam 2016-08-31 04-56-20-772.png

This is the message. I can click 'OK' and the Preset still applies though it is quite annoying as the Warning pops up every single time i want to apply any preset.

 

var GaussianBlur = new File('F:\\AMVs\\Adobe After Effects CS6\\Support Files\\Plug-ins\\Effects\\Gaussian_Blur.aex');

function blurBg(){

    var layerScale = null;

        for( var i=1; i <= pComp.numLayers; i++){

           i += 1;

           layerScale = pComp.layer(i).scale.value;

           layerScale[1] = (pCompWidth/pComp.layer(i).width)*100;

           layerScale[0] = (pCompWidth/pComp.layer(i).width)*100;

           pComp.layer(i).scale.setValue(layerScale);

           pComp.layer(i).applyPreset(GaussianBlur);

       }

}

blurBg();

 

A bit of context: I import a bunch of pictures and create layers of them, then i duplicate each layer and resize them (behind the original) and apply a Blur effect.

 

Is there a way to fix this?

or in worst case there a way to actuommatically skip the Warning(Since the effect still applies)?

Event listeners generate errors while modal windows are shown.

$
0
0

Hello all,

 

I have an interface in script ui that relies on event listeners initialized like this:

var button = palette.add("image", rect);
button.onDraw = buttonDraw;
button.addEventListener('mouseover', onMouse, false);
button.addEventListener('mouseout', onMouse, false);
button.addEventListener('mousedown', onMouse, false);
button.addEventListener('mouseup', onMouse, false);

 

I need these events so I can change images (fake buttons) when the user moves the mouse over them or clicks one of them. Everything works as it should, until I decided to render something. While rendering in After Effects, a window or something is opened somewhere and it makes all scripts useless, they do not respond to user input at all, and that's fine to me. It works the same for all scripts that I tested.

The real problem is with event listeners. Scripts that use them will generate a background error if any listener is activated. And when the render finishes, AE will show a popup message letting you know about these errors. Also the script interface will stop running completely until you close it an open it again.

 

The error message is:

"Can not run a script while a modal dialog is waiting for response."

 

I thought of replacing all listeners with the other type of callback like "onClick", but it seems there's no workaround for "mouseover" or "mouseout".

 

This is a real issue for my UI, as if the user has my panel docked somewhere in the interface and simply moves the mouse over any of the buttons, he will end up with the error message at the end of the render. There's also nothing I can do to avoid the listeners from running, since after the script is loaded, we lose all control of what's going on with it, no way to remove the listeners temporarily.

 

Any ideas on how to solve this?

New UI Element Not "Filling" Correctly

$
0
0

I'm having a hard time with adding a new element into the UI while making it 'fill' properly with the current elements.

 

Let's say I have a container that is 500px. The container has 2 buttons set to fill, so they take up 250px each and are nicely even.

When I add another button into this container, I'd expect each button to be 500px/3, or 166.667px now since all 3 buttons can fit in the 500px container evenly.

This does not happen, and instead, the two buttons that were originally present only shrink very little, making the new third button very tiny. Basically, things aren't even.

 

Any idea why this is happening?

 

I'm referencing a modified UI of David Torno's example (Dynamically add and remove ScriptUI elements ) to demonstrate this, since my current project is too large to post.

 

    function SCRIPTNAME(thisObj){           function SCRIPTNAME_buildUI(thisObj){               var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", "SCRIPTNAME", undefined, {resizeable:true});               if (pal != null){                     var res ="group {orientation:'column', alignment:['fill','fill'], alignChildren:['fill','fill'],\                              group1: Group{orientation:'row', alignment:['fill','top'], alignChildren:['fill','top'],\                                  addButton: Button{text:'ADD'},\                                  removeButton: Button{text:'REMOVE'},\                              },\                              group2: Group{orientation:'row', alignment:['fill','fill'], alignChildren:['fill','fill'],\                              },\                    }";                      pal.grp = pal.add(res);                       ///CONTROL VARIABLES                     var group1 = pal.grp.group1;                     var addButton = group1.addButton;                     var removeButton = group1.removeButton;                     var group2 = pal.grp.group2;                                         ///ADD NEW CONTENT TO GROUP2                     addButton.onClick = function(){                         var g = group2.add('panel', undefined, "myPanel");    //Add a group                         g.orientation = "row";                         g.add('button', undefined, "btn1");    //Add a button to that group                         g.add('button', undefined, "btn2");    //Add another button to that group                         updateUILayout(group2);    //Update UI                     }                                   ///REMOVE CONTENT FROM GROUP2                     removeButton.onClick = function(){                         var kids = group2.children;                         var numKids = kids.length;                         if(numKids > 0){    //Verify that at least one child exists                               group2.remove(kids[numKids-1]);    //Remove last child in the container                         }                         updateUILayout(group2);    //Update UI                     }                                         ///UPDATE UI EASILY TO REFLECT ADD/REMOVE CHANGES                     function updateUILayout(container){                         container.layout.layout(true);    //Update the container                         pal.layout.layout(true);    //Then update the main UI layout                     }               }                 pal.layout.layout(true);               pal.grp.minimumSize = pal.grp.size;               pal.layout.resize();               pal.onResizing = pal.onResize = function () {this.layout.resize();}                                   return pal;           }                     var SCRIPTNAMEPal = SCRIPTNAME_buildUI(thisObj);           if (SCRIPTNAMEPal != null){               if (SCRIPTNAMEPal instanceof Window){                     SCRIPTNAMEPal.center();                     SCRIPTNAMEPal.show();               }           }     }       SCRIPTNAME(this); 

 

ui-responsive-problem.jpg

When doing it this way, the UI behaves how I'd expect and elements resize evenly upon adding. What gets interesting is that if you change line 26 to remove the panel. (Change the line to var g = group2, so we're just adding buttons directly into group2 instead of adding a new panel each time). Now, if you add buttons directly into the group, the buttons do not resize evenly anymore unlike when they're added with the panel.

 

Any help would be much appreciated!

considering add a File-path property for a placeholder footage?

$
0
0

by far the property of placeholder only include (name, width, height, frameRate, duration)

and the .mainSource couldn't change the file path of a placeholder

when we import multi placeholders in a project with script and replace it by other file by human hands it couldn't find other missing footage automatically

Calling ExternalObject in OSX gives me IOError: I/O Error.

$
0
0

Hello,

 

I have a script as a complement of a plugin, and I use the ExternalObject class in javascript to call an internal function in my plugin.

Everything works as expected in windows, but I'm getting an IOError in OSX. I know the path for the lib is correct, if it wasn't, the error would be different.

I think it has nothing to do with the actual exported function either, as the script never gets to the point of calling it. Either way, I checked the library exports, and my function is "visible" from the outside.

 

this is what I have:

try
{
var myLib = new ExternalObject("lib:" + pluginPath + libFilename);
myLib.execute("requeststatus");
myLib.unload();
}
catch(e)
{
alert(e);
}

 

The script halts when the first line is executed, It never reaches the second line with the actual execute. I also copied the library to another path to avoid problems with permissions, but no change in the result.

 

Any help would be appreciated.

Slider control

$
0
0

hello,

 

I try to control a composition with a null object with a slider linked to the composition's opacity

 

if(thisComp.layer("Nul Controle glissiere").effect("bouche")("Curseur"==1) 100 else 0

 

What's wrong with this script ? I always have this Alert : Expected: ).

 

thank you

AEGP Plugin PNGIO Support... Unable to decode PNG file

$
0
0

I have a node file that downloads a static map file as a .png (I have also tried downloading it as a .jpg) and adds it as a layer to a comp via CSInterface. The first time I do so, I consistently get this error:

 

AEGP Plugin PNGIO Support: PNGIO library error: Unable to decode PNG file (5027 :: 12)

 

However, the image does import and show up as a layer in the comp. (Also, oddly, it is not visible in the comp until I move the playhead.)

 

If I try importing again, I do not get the error.

 

Has anyone else encountered this kind of thing when importing images and/or found a solution?


Script to Change Active Composition Duration

$
0
0

This should be really simple, but I can't seem to get it right.  I need a script that takes the active composition and changes duration to be EXACTLY 4 seconds long.  I'm using a 59.94 fps timecode that is non-drop frame.  So whenever this script is run, the only thing it should do is change the active composition so that it starts at 0:00:00:00 (hours, minutes, seconds, frames) and ends at 0:03:59:59.  I tried to use the "duration" in my script, but when I set it equal to 240 (60 seconds * 4), my composition ended up at 0:03:59:45 for some reason.  My frames were messed up.  Can somebody please show me a script that allows will do exactly what I have in bold above?

Maping frame-numbers between precomp and containing comp

$
0
0

Hi,

 

the simple question first:

How do I get the length of the darker-red-area in extendscript?

I don't even know how to get the exact value on the AE-GUI...

AE.png

The background:

I am currently trying to edit a precomp using a script. Part of the process is to edit the properties of the precomp-layer based on information that can be found on layers inside the precomp.

It's working perfectly fine. The only issue remaining is the offset generated by this dark-red-area: The precomp has an in-time of 2s as you can see. The frame that is rendered at this time is not the first frame inside the precomp, but the frame at about 1.5s. How do I get the exact number of frames that is truncated here?

 

Thank you very much!

Timecode parsing for user input

$
0
0

I have a script that allows users to enter timecode as a string, and I wanted it to perform the same as the Timecode inputs in the rest of the program: if they type "1..." I want it to register as 1:00:00:00 without them having to type a correctly formatted string.

 

This. Took. Ages. I descended deep into the regex underworld, but I'm happy to say that I managed to placate the JS gods with my mad skillz on the lyre and returned victorious. So for any other young traveller preparing to take the journey, here's what I worked out. If you have suggestions, please, let me know.

 

function parseTimeString(theString, comp) {    comp = app.project.activeItem; //need an active comp in order to get the frameDuration    if (comp) {        theString = "" + theString;        //allows user to lazily enter timecode, eg. to enter 1 minute you type 1.. rather than 0:1:0:0        //this took ages to work out..        var hrsStr = theString.match(/(\d+)\D\d*\D\d*\D\d*$/); //matches  "0:1:2:3" and "0..." and returns '0'        var minStr = theString.match(/(\d+)\D\d*\D\d*$/); //matches "0:1:2:3" , "1,2.3" and "1.." and returns 1        var secStr = theString.match(/(\d+)\D\d*$/); //and so on..        var frmStr = theString.match(/(\d+)$/);        //convert the strings to time values        var hrs = hrsStr            ? parseInt(hrsStr)            : 0;        var min = minStr            ? parseInt(minStr)            : 0;        var sec = secStr            ? parseInt(secStr)            : 0;        var frm = frmStr            ? parseInt(frmStr)            : 0;        //return the result as time, measured in seconds        return 3600 * hrs + 60 * min + sec + comp.frameDuration * frm;    }    return false;
}

Hi to all my first time for me her hope I'm doing right . I'm looking for scripts for affter effect cs6 that calld

$
0
0

Hi to all my first time for me her hope I'm doing right . I'm looking for scripts for affter effect cs6 that calld

ExportTovsa.jsx

&

RenderTovsa.jsx

 

??????

Point Controller using ScriptUI

$
0
0

Hi all again,

 

Is there a way to add a button with similar usage to the Point Controller effect to a ScriptUI palette?

I wish to allow the user to select a point in the comp's viewer and get the X, Y values back after interaction -- similar to the Target Icon in most point controllers of most effects.

I saw you can do this with Pseudo Effects... no way to do it using ScriptUI? Or another method?

I tried adding a Point Controller effect to a layer using script and somehow invoking a button press on the Target Icon of the effect - no success here.

Any Ideas?

 

Thanks a lot

Roy.

Is there something like sampleImage() for a Comp?

$
0
0

Hi everyone,

 

I couldn't find any reference for this -

Can I check the alpha value of a comp pixel and not a layer pixel (similar to a layer's sampleImage() method)?

 

AEScripts.com and various other places have scripts like these:

Auto Crop - aescripts + aeplugins - aescripts.com

pt_CropPrecomps - aescripts + aeplugins - aescripts.com 

 

How do the various auto crop scripts know where the comp's layers transparency is in order to crop it to the layers' actual size?

I don't necessarily want to crop a comp - just get the alpha values of a comp in a script... or whatever method those auto-crop scripts use.

 

Thanks a lot in advance,

Roy

Storing duplicate layer in variable "Function Object is undefined"

$
0
0

Im trying to write a script that duplicates and mirrors a layer across the center axis. This is also my first script in after effects to try getting the feel for it.

However im not sure what the problem is. Is the problem with storing the duplicate layer in the variable? Or am i using the object the wrong way to scale/transform it.

 

 

#target aftereffects

var center = 3840;
var layers = app.project.activeItem.selectedLayers;

for (x in layers) {
    var old_position = layers[x].transform.position.value;    var new_position = (center-old_position[0]) + center;    var new_layer = layers[x].duplicate();    new_layer.transform.scale(-100, 100);    new_layer.transform.position(new_position, old_position[1], old_position[2]);
}

Why $.level in script always = 1 in after cc 2015?

$
0
0

"The current debugging level."

Before 2015 $.level = 0 in native After Effects start

LZ2OKKS.jpg

and = 1 in ESTK

ooJFWja.jpg

Now CC 2015 always $.level = 1

applyPreset error

$
0
0

Hi

 

I have a script UI Palette. It adds an ffx preset to a controller null using applyPreset. It also adds different expression to various properties on a layer. So that this layer is now controlled by the controller null.

This works fine. But the script can also replace the ffx with a different ffx. When I do that, first I delete all expressions on the layer being controlled. Then I remove the current effect on the controller and adds a new ffx. Last I add new expressions to the layer.

 

When doing that, the shift. AE starts behaving wierldy. The expressions doesn't work, even though they are correct. And if I undo or try to do anything with the new effect added, I get this error:

"After Effects error: internal verification failure, sorry! {stream at index has wrong matchname} (29::0)"

EDIT: Actually if I undo I get this error: "After Effects error: internal verification failure, sorry! {invalid index in indexed group}"

 

The presets I add are located in the Scripts/ScriptUI Panels/myplugin folder.

I created them using https://videohive.net/item/flex-effector/12444265

I'm on OSX using AE 13.8.1.38 (I will try on a windows machine later today)

 

Any ideas?

 

Thanks,

Jakob

how to use code to control aftereffects?etc import files,put them on the timeline,put some effect on the layer...

$
0
0

is there any way,that i can fully control aftereffects with code?

 

i want to auto import some files,use code to put them on the timeline, and maybe use some plugin,and finally render ,and e-mail the files.

 

maybe i can write a script, and by run it in console?

and where can i get the script tutorial?

 

thank you for your help

How to have various text styles in a single textbox via scripting

$
0
0

I am searching for a way do to have some control over styling word in a textbox via scripting. For exemple, I want to put, in a textbox, the words:

 

“Lt amet, consectetur adipiscing elit”

 

I know how to make the whole textbox bold, but how can I get that word to be bold without affecting the entire textbox?

Combinig sampleImage and valueAtTime

$
0
0

Hi

 

I have a layer which scale is using sampleImage to set it's value. So it samples the color from a different layer and sets it's scale values accordantly.

I then have a script which loops through every frame, gets the value using valueAtTime and sets it as a keyframe. Essentially baking the transformation to keyframes.

 

This doesn't work. If I have any other expressions it works. So it seems it is a problem with the sampleImage. It's like it doesn't have time to sample the image before it runs valueAtTime.

 

I tried moving the playhead to the given time before calling valueAtTime. This works a little better. But still only about half of the frames will sample the right value.

Last I tried caching all frames first. Still, no luck.

 

Any ideas how to solve this?

 

Thanks,

Jakob

Viewing all 2143 articles
Browse latest View live


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