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

Sort specific Files by Name termination

$
0
0

Hello everyone ,

 

i have a comp with many type a file(png,swf....),and i want to use only the swf one ,

put them at the end and distribute them by name using the first part of the name ..

 

(00_file01.swf      01_file01.swf  02_file02.swf  03_file03.swf.........)

 

I try to do that :

...

here the others files...

...

.....

02_file02.swf

01_file01.swf

00_file01.swf   

 

i do that code for the moment but i dont know how to check the first part of the name and continue the loop...

 

 

//step01

  for (i=0;i<app.project.activeItem.layers.length;i++) {

if ((app.project.activeItem.layer(i+1).name.toLowerCase().indexOf('.swf') != -1)&& (app.project.activeItem.layer(i+1).name.split("_")[0]=="00"))

app.project.activeItem.layer(i+1).selected = true;

}

app.project.activeItem.selectedLayers[0].moveToEnd();

var Swf_00=app.project.activeItem.selectedLayers[0].index

var PosSwf00=app.project.activeItem.layer(Swf_00)

 

//#selectNone

for (i=0;i<app.project.activeItem.layers.length;i++) {

app.project.activeItem.layer(i+1).selected = false;

}

 

//step02

  for (i=0;i<app.project.activeItem.layers.length;i++) {

if ((app.project.activeItem.layer(i+1).name.toLowerCase().indexOf('.swf') != -1)&& (app.project.activeItem.layer(i+1).name.split("_")[0]=="01"))

app.project.activeItem.layer(i+1).selected = true;

}

 

app.project.activeItem.selectedLayers[0].moveBefore(PosSwf00);

var Swf_01=app.project.activeItem.selectedLayers[0].index

 

 

//step03

  for (i=0;i<app.project.activeItem.layers.length;i++) {

if ((app.project.activeItem.layer(i+1).name.toLowerCase().indexOf('.swf') != -1)&& (app.project.activeItem.layer(i+1).name.split("_")[0]=="02"))

app.project.activeItem.layer(i+1).moveBefore(app.project.activeItem.layer(Swf_01));

}


copyToComp undo crash

$
0
0

So I've come across an issue with a script I'm currently writing.

 

Basically if you undo after using 'copyToComp' on a layer with effects on it it will crash AE (at least it does on 14.2.1).

 

Has anyone else encountered this issue?

cansetexpression is false, unable to set value

$
0
0

Hey guys,

I'm writing a script that will copy the layer setup (complete with layer styles, effects, etc) of a comp that I can duplicate on another comp.

 

For the most part, it's working, except on a specific effect I'm trying to copy. I'm finding I can't set the value for certain attributes - they throw the following error:

Error: After Effects error: Can not “set value” with this property, because the property or a parent property is hidden.

But if I write a separate script that attempts to set the value well after the whole effect has been populated, it has no problems.

 

By the way, in case it's relevant, the effect that's causing the problems is called OLM Color Key, and it has a property called Number of Colors that allows you to change the number of colors it samples (up to 25, I believe). Each of those colors has a Color attribute and a Use Color attribute. The Use Color property is the property I mentioned above that's causing problems. If Use Color is unchecked, the effect behaves as if that color wasn't in its array. The problem is I can set the Use Color property with Extendscript for the FIRST color, but no colors afterward. Do you guys have any idea why that would be the case? Does it have anything to do with the Number of Colors attribute enabling/disabling colors?

 

Cursor coordinates in a treeview with a scrollbar

$
0
0

Greetings good Sir,

 

I am trying to select an item just by hovering over one in a treeview. In order to do so, I create an addEventListener associated to the treeview and recover the cursor position using the clientX / clientY values.

Please find below an example but with a click event instead (to simplify the code):

 

     Palette.Treeview.size = [200, 100];

     myOnClick = function(p)

    {

        alert(p.clientY);

    };

    Palette.Treeview.addEventListener('click', myOnClick); 

 

The problem: clientY gives the position of the cursor relative to the position of the treeview within the window and so, does not take into account the scrolling.

 

Adobe's Javascript Tool Guide and "Script UI for dummies" make it seems like the scrollbar is inaccessible inside a treeview. True enough, I was unable to add a scrollbar to a treeview.

 

So here come my questions:

Can the cursor position within the "virtual" treeview space be obtained?

Otherwise, is there a way to obtain the scrolling value of scrollbars naturally occurring in treeviews?

Ui Update Path Dynamically

$
0
0

Hello , i'm trying to make an UI to import my presets .ffx

 

I have a main folder named MyPresetFolder ,and inside ,two other folders named Preset_Files_01 and Preset_Files_02 .

and inside each Presets_Files ,a lot of .ffx

 

What i want to do with my ui is when i choose the file 1 or 2 ,the seconde line update the list to load ...

with my code, it's works only at the beginning ..i dont know how to said if i change the select folder,update the folder preset.....

 

if someboy can help me ??

Thanks everyone...

 

Here is my code

 

 

function FFX(obj)

//===============================================

    //================= UI============================

    //===============================================

{   

    function addHGroup(conteneur){

var groupe = conteneur.add("group");

groupe.alignChildren = ["fill","fill"];

groupe.orientation = "row";

groupe.spacing = 1;

groupe.margins = 0;

return groupe;

    }

    function addVGroup(conteneur){

        var groupe = conteneur.add("group");

        groupe.alignChildren = ["fill","fill"];

        groupe.orientation = "column";

        groupe.spacing = 1;

        groupe.margins = 0;

        return groupe;

    }   

    var fenetre = obj instanceof Panel ? obj : new Window("window","MyPresets",undefined,{resizeable:true});

    fenetre.alignChildren = ["fill", "top"];

    fenetre.spacing  = 2;

    fenetre.margins = 3;

 

 

    var versionGroup3 = addHGroup(fenetre);

    versionGroup3.alignment = ["fill","bottom"];

 

    var widthGroup = addHGroup(fenetre);

    widthGroup.alignChildren = ["fill","center"];

    var PATH_Button = widthGroup.add("button",undefined,"Load");  

//________________________________________________________________________________________ ________________________________________________

   

  var presetsFolder = Folder("~/Desktop/MyPresetFolder");

var arrayPresets = presetsFolder.getFiles('Preset*'); 

var fileNames = getFileNames(arrayPresets); 

 

function getFileNames(arrayPresets) { 

    var fileNames = [], 

        baseName = ""; 

 

    for (var i = 0, il = arrayPresets.length; i < il; i++) { 

        baseName = arrayPresets[i].displayName.split("_")[0]; 

        fileNames.push(baseName); 

    } 

    return fileNames; 

 

var widthGroup = addHGroup(fenetre);

widthGroup.add("statictext", [0,0,80,18], "Select Folder:");

var Chemin1 = widthGroup.add('dropdownlist', [0,0,200,18], fileNames);

            Chemin1.selection = 0;

           

            //alert(Chemin1.selection.text)

//________________________________________________________________________________________ ________________________________________________

 

 

  var presetsFolder2 = Folder("~/Desktop/MyPresetFolder/"+(Chemin1.selection.text));

 

    //alert(presetsFolder2)

   

var arrayPresets2 = presetsFolder2.getFiles('*.ffx'); 

var fileNames2 = getFileNames(arrayPresets2); 

 

function getFileNames(arrayPresets2) { 

    var fileNames2 = [], 

        baseName2 = ""; 

 

    for (var i = 0, il = arrayPresets2.length; i < il; i++) { 

        baseName2 = arrayPresets2[i].displayName.split(".")[0]; 

        fileNames2.push(baseName2); 

    } 

    return fileNames2; 

 

var widthGroup = addHGroup(fenetre);

widthGroup.add("statictext", [0,0,80,18], "Select Preset:");

var Chemin2 = widthGroup.add('dropdownlist', [0,0,200,18], fileNames2);

            Chemin2.selection = 0;

 

 

//CLICK ALL____________________________________________________________________

 

 

PATH_Button.onClick = function (){

   

  

    }

 

//================= AFFICHAGE DE L'UI ============

    fenetre.layout.layout(true);

    fenetre.layout.resize();

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

    if (fenetre != null ) if (fenetre instanceof Window) fenetre.show();

    }

 

 

FFX(this);

What are aae files and how do I open them?

$
0
0

I uploaded pictures and videos from my iPhone 5S to my PC and got a lot of aae files that I couldn't open.  It was telling me I didn't have permission to open the file even though I'm the administrator.  What am I up against here?

How to change the layer color?

$
0
0

I have tried to find information about this but I have not find nothing, there's something but deprecated. I'm pretty sure that id not a hard thing to achieve.

 

Could anyone help please?

 

Thanks!!!

For loop only ones because layers.add, why?

$
0
0

I have some layers, and I want to add, from the project stack, a null before each layer so I type this:

#target aftereffects


var theComp = app.project.activeItem;
var theLayer;
var dummyNull;
var dummyLayer;


{
    for (var i = 1 ; i <= app.project.numItems; i++)    {        if (app.project.item(i).name == "DUMMY") dummyNull = app.project.item(i);    }    for (var k = 0; k < theComp.selectedLayers.length; k++)    {            theLayer = theComp.selectedLayers[k];                       dummyLayer = theComp.layers.add(dummyNull);            dummyLayer.moveBefore(theLayer);            //THIS LOOP ONLY RUNS ONES, WHY?    }
}

 

why does only do one loop?


Help!! footage won't open

Check if a null position is inside a circular area

$
0
0

This is a tricky one. Is it possible to check somehow if a null object position values are inside a circular shape area?

Thanks!

cuda

$
0
0

le lancer de rayon est inactif malgré la compatibilité de ma carte video

comment ajouter ma carte dans after effects et première pro

 

textProp.setValue() unbearably slow for larger strings

$
0
0

Hello everyone,

 

I've got an annoying problem. I want to set the text on a text layer like you would normally through a script. Usually, this is fast enough but let's say I wanted to set a large piece of text

to a paragraph box like so:

 

    var s = "some long text";
    var td = layer.property("Source Text").value;    
    td.text = s;    
    layer.property("Source Text").setValue(td);

If the text is too long, say 300+ characters, it takes forever to set the value. I thought that this is maybe a general problem with After Effects, but this doesnt happen if I copy and paste the text into the box through the UI. I tried running the script with the -noui arg but it made a negligible difference.

 

Any scripting wizard out there that can help me understand why this is happening?

 

Thanks

ExtendScript Throws on Nested Ternary Operator

$
0
0

Just filed this bug with Adobe, but wondering if anyone else has run into this:

ExtendScript wasn't listed in the products list for submitting a bug, so that's why I'm using the After Effects bug form for this issue.

When attempting to use a nested ternary (AKA conditional) operatory in ExtendScript (`<test1 expression> ? <test2 expression> ? <if test2 true> : <if test2 false> : <if test1 false>`), it errors rather than running as it should.

 

Steps to Reproduce Bug:

1. Open ExtendScript

2. Paste the following into a new source file (don't include the backticks): `true ? true ? "one" : "two" : "three";`

3. Run the script

 

Results: Errors at second question mark ("?") with the error: "Expected: : "

 

Expected Results: Should have run successfully and returned "one".

 

I assume that this is an artifact of the implementation of ECMAScript-262 for ExtendScript, but I don't know. This shouldn't error though.

 

Originally posted this question here and was directed elsewhere.

ExtendScript Throws on Nested Ternary Operator

$
0
0

Just filed this bug with Adobe, but wondering if anyone else has run into this:

ExtendScript wasn't listed in the products list for submitting a bug, so that's why I'm using the After Effects bug form for this issue.

When attempting to use a nested ternary (AKA conditional) operatory in ExtendScript (`<test1 expression> ? <test2 expression> ? <if test2 true> : <if test2 false> : <if test1 false>`), it errors rather than running as it should.

 

Steps to Reproduce Bug:

1. Open ExtendScript

2. Paste the following into a new source file (don't include the backticks): `true ? true ? "one" : "two" : "three";`

3. Run the script

 

Results: Errors at second question mark ("?") with the error: "Expected: : "

 

Expected Results: Should have run successfully and returned "one".

 

I assume that this is an artifact of the implementation of ECMAScript-262 for ExtendScript, but I don't know. This shouldn't error though.

 

Originally posted this question here and was directed elsewhere.

move a existing Key to a specific Time

$
0
0

Hello all,

 

For a client, I am trying  to move a existing key to a specific time.

Do you know if it's possible to do this kind of stuff or not all?

 

If I select my key like this:

var activeItem = app.project.activeItem;

var theLayers = app.project.activeItem.selectedLayers;

var theLayer = theLayers[0];

var myKey = theLayer.position.setSelectedAtKey(3, true);

 

Can I move it to a specific time?

Or should I get all the value and the interpolation to set to a new keyFrame?

 

Cheers


Scripting (or existing plugin): Auto-animate camera to show the image row by row

$
0
0

Hey, I'm an artist, and I like to show the detail in my paintings. Currently, manually keyframing this takes a long time. Here's the breakdown:

 

1. automate After Effects to evaluate image - Zoom out until full X&Y dimensions of a piece show (You can see the entire image - 9,000x12,000 pixels is not uncommon).

2. Zoom in to 100% of image size - composition output is 720p or 1080p.

3. Pan to top left corner of image (X=0, Y=0 defined as top left)

4. Pan to the right until X is maxed out.

5. Pause for a few frames.

6. Scroll down to where the bottom of the 1st pan across is now above the current comp area. ( Y = Y- Comp height )

7. Pause for a few frames.

8. Pan left until X=0

9. Pause for a few frames.

and repeat this scanning from side to side until the bottom of the image.

10. Gently zoom out until image is fully on screen.

 

I checked every page of Video Hive and Ae Scripts and couldn't find something that already does this.

 

Here is an example (FB video) of the final piece (done manually) - https://www.facebook.com/ori.bengal/videos/10153061773317426/?hc_location=ufi

Sending to media encoder and remove from render queue - error

$
0
0

Hi guys,

 

I'm sending a comp from render Queue  to Media Encoder,

and then I'm removing the item from render Queue.

 

but when I run the code, After effects crashes .

 

Any help?

 

This is my code:

{ var Comp=app.project.item(1);//my item // Scripting support for Queue in AME. // Requires Adobe Media Encoder 11.0. {     if (app.project.renderQueue.canQueueInAME == true)     {         // Send queued items to AME, but do not start rendering.         app.project.renderQueue.queueInAME(false);      }     else {         alert("There are no queued item in the Render Queue.");     } } app.project.renderQueue.item(1).remove();// remove comp from renderQueue; }

Dynamically add and remove ScriptUI elements

$
0
0

Hello. I'm looking for a way to add and remove elements like groups on click.

The idea is to generate them instead of toggling .visible option on and off.

 

Though after searching through manuals I'm still unsure how to do this.

CSTK2 Version 2 Out

$
0
0

Hi All,

 

Firstly I shall apologize for multi posting this post across several forums I have done so as I'm sure the extension will be very useful for scripters / developers across range of products.

 

The CSTK has 2 components to it.

1) An in-app console for JSX, JS and Shell. This is very useful for amongst other things examining DOM properties without needing to leave the extension or seeing if JS snippets work on the app.

2) A selection of HTML extension tools

 

I works on Photoshop, InDesign, InCopy, Illustrator,  After Effects, Premier Pro and partially works on Dreamweaver.

CSTK2.gif

Check out these links to install it and for further info.

CSTK In Adobe App Console and Development Tool | Creative-Scripts.com

GitHub - Trevor-/CSTK: Adobe HTML extension Console for js, jsx and shell and extensions development help

 

Enjoy, Trevor

AE Script - Save in subfolder

$
0
0

Hey Folks,

I have the following Problem. With my script I automatically add a RGBA DPX Sequence to the RenderQueue, the problem is that "save in subfolder" is NOT checked. If I add a comp manually with the same DPX RGBA output module, save in subfolder is automatically activated.

I don't know why my script deactivates that option?

 

Also if I add a comp manually, and then just change the output module to DPX using a script, it works just fine, with the save in subfolder option activated. And if I duplicate the RenderQueue Item, which was created using my script with save in subfolder NOT checked, it suddenly IS checked after duplicating.

 

This is the responsible part of my script:

 

var DPX = "DPX RGBA";

                var h264Prev = "h.264_shotgun_preview";

 

 

                var theRender = app.project.renderQueue.items.add(masterComp);

                      theRender.outputModules[1].applyTemplate(DPX);

                      theRender.outputModules.add();

                      theRender.outputModules[2].applyTemplate(h264Prev);

                    

                //Change Path

                var myRQ = projFl.renderQueue;

                var renderPath = projPath + "/" + "afx" + "/" + "renders" + "/";

                var prevPath = projPath + "/" + "afx" + "/" + "renders" + "/" + "previews" + "/";

                var oldName;

              

                oldName = myRQ.item(1).outputModule(1).file.name;

              

                myRQ.item(1).outputModule(1).file = new File(renderPath + oldName); //If I take out this part, the "save in subfolder" option stays enabled.

                myRQ.item(1).outputModule(2).file = new File(prevPath + oldName);

 

I had a look at the change render location script, but that didn't help me.

 

I'd be really thankful for some input

 

Cheers

Viewing all 2143 articles
Browse latest View live


Latest Images

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