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

AE CC - onClose()

$
0
0

Hi,

 

I'm trying to save the user's settings when they close the script window, but can't for the life of me figure it out.

 

This executes wonderfully in Extendscript CS6, but when I run it in AECC I don't get an alert.

 

myPalette.onClose = function () {          alert("settings saved");
}

 

 

Any ideas? Thanks.


afterfx command line "restores" maximized window - any way to duplicate ExtendScript invocation?

$
0
0

Hi all,

 

I am controlling After Effects CC from another application by invoking JavaScript files from the command line. But the command *always* restores the maximized window of After Effects. That is, if the After Effects application is maximized, it always *restores* it, every time I invoke the JavaScript file through the command line (e.g. through Windows cmd prompt or through my application). When I execute the same JavaScript file through ExtendScript IDE, it doesn't do this erronous behaviour.

 

For example: "AfterFx.exe -r C:\path\showDialog.jsx"

 

Contents of showDialog.jsx:

----------

alert("Showing Dialog from JSX file");

----------

 

My question is: Is there *any way* to mimic what ExtendScript does to invoke JavaScript files?

From listening on Windows processes, it seems that ExtendScript tacks on some JavaScript code, dynamically, to do the execution (i.e. couldn't trace any command line processes/arguments). But I can't seem to figure out what exact JavaScript code it invokes. ExtendScript also seems to be working via Bridge.

 

I get the same "restore window" behaviour when I try to use "-s" argument with the JavaScript expression passed as a string argument or if I use "AfterFx.com" instead of "AfterFx.exe". I couldn't find any documentation for what command line parameters are supported for AfterFx (other than "-r" and "-s") and what Extend Script might be doing exactly to invoke the .jsx files. I managed to take a peek at the executable binary of AfterFx.exe (through a hex editor) and noticed the following switches.

-rquiet, -noerr, -noui, -debug, -livelink, -selflink, -headlessonly, -rquiet, -rq, -mp

 

But I couldn't get the "window restoring" behaviour to stop with any of the parameters.

 

Any advice will be really appreciated.

 

 

Thanks.

Strange noise problem with music layer after replacing the music file using script in CS6

$
0
0

Hey guys,

 

I got a strange problem. Sometime when I import a music file, or replace a music footage with another music file using the "replace()" or "importFile()" method, the music layer added one second noise at the beginning. like this,

noise.jpg

Does anyone know what's going on here?

I'm using After Effects CS6 windows Server 2008 64bit.

 

Thanks in advance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Strange noise problem with music layer after replacing the music file using script in CS6

$
0
0

Hey guys,

 

I got a strange problem. Sometime when I import a music file, or replace a music footage with another music file using the "replace()" or "importFile()" method, the music layer added one second noise at the beginning. like this,

noise.jpg

Does anyone know what's going on here?

I'm using After Effects CS6 windows Server 2008 64bit.

 

Thanks in advance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Issue with icon button title layout

$
0
0

Hi,

 

I am new to After Effects scripting and am struggling with this issue for quite some time. I need to display iconbuttons in a window where the the title of the button should appear below the icon. I am using the below code:

 

var myWin = new Window ("palette", "My Window", undefined, {resizeable: true});

var f = File ("./Assets/im.png");

var iconButton= myWin.add("iconbutton", undefined,  f, {style: 'toolbutton'});

iconButton.title = "Import";

iconButton.titleLayout = {alignment:['center', 'bottom']};

myWin.show();

 

This works fine when I test it in ESTK. But the moment I run the script from within After Effects, the title shifts to the left of the icon. I am not sure what am I missing here. Any help would be highly appreciated.

 

Thanks.

Can I batch render a composition with different resources?

$
0
0

Hi All,

 

I've got a composition that I want to render and send out to a large number of people (around 1000) as a video file. One element of this composition includes an image depicting the viewer. I have all of images of each person, and I was wondering whether or not I could set AE to render out 1000 copies of the composition, substituting the generic image for the image of each viewer in turn. I'd also like to be able to change the contents of a text layer to include the name of that viewer (I've got that in a CSV at the moment). Is this possible? The exponential increase in processing time is not an issue for my purposes; in fact, doing it this way would mean a dramatic decrease in time spent on another part of the project.

 

EDIT: I've just realised I could use Javascript to call from an array of names for the text, but how would I get the array index to iterate each time it's exported?

 

Thanks in advance!

Command line render "-reuse" flag with multiple copies of afterFx.exe

$
0
0

The question is, can i use "-reuse" flag to start rendering with more than one copy of afterFx.exe ?

 

 

//OS Windows 7

If i start

aerender.exe -project c:\projects\project_1.aep

I have to wait about 15 seconds until the After is started and only then start rendering.

But I can start the After in advance.

Start

aerender.exe -project c:\projects\project_1.aep -reuse

And then render will begin immediately.

 

 

Unfortunately one copy of After effects does not use the power of my computer at 100%. // I need about 5 copies.

So I tried:

 

 

Execute in command promt:

AfterFx.exe -m -noui

AfterFx.exe -m -noui

AfterFx.exe -m -noui

 

 

Then execute:

aerender.exe -project c:\projects\project_1.aep -reuse

aerender.exe -project c:\projects\project_1.aep -reuse

aerender.exe -project c:\projects\project_1.aep -reuse

 

 

But only the first copy of AfterFx was used. The following two commands of aerender  have launched a new copies of AfterFx.

 

 

Any ideas?

 

 

P.S. I know about the "-mp" flag, it is not a solution.

Convert GUI "edittext" to a Number

$
0
0

Hi There

 

I´ve build a GUI with an edittext box where I want to put in numbers, to use them later for calculating, generating layers and so on.

But I always come along with NaN (Not a Number).

 

Script example:

 

var myWin = new Window("palette","Create a number of layers in a circle",undefined);

myWin.orientation = "column";

 

var groupOne = myWin.add("group", undefined, "GroupOne");

groupOne.orientation = "row";

 

groupOne.add("statictext", undefined, "Number of Pieces");

var inputNumber = groupOne.add("edittext", [0,0,40,20], "6");

 

 

 

How can I convert this edit text (6) from that string to a number, so that I can use it?

And, have I to check,  that my input text is a number?

 

 

THX for your help ....


Use GUI checkbox for scripting

$
0
0

Hi There

 

How can I use the GUI checkbox option in my script to turn Motion Blur ON or leave it OFF?

 

 

For example I´ve generated this checkbox in my GUI Panel:

 

var checkMB = groupTwo.add("checkbox", undefined, "Motion Blur ON");

 

 

How can I ask if it is checked or not and use this information.

 

For this example I want to ask "if I plan to use Motion Blur". And if so, the Motion Blur Button in the Timeline should set to ON.

I found some code for the Shy Button, but nothing for the MB button. (xxx.hideShyLayers = true;)

Scripting AE addSlider

$
0
0

Hello Community


I want to write a script to add a slider control to a layer and set the values for the control.

To set the value for the slider value works, but I found no way to set the min and max values of this slider, which can be found by right click on the slider and edit this values.


My scripting lines so far are:


var ScaleWCtrl = newNull.property("Effects").addProperty("ADBE Slider Control");
ScaleWCtrl.name ="Scale Factor Width";
ScaleWCtrl.property(1).setValue(1);


I´ve tried to set a value at property "2", if there is one, but did not work.



Some ideas?

Reload a secuence of pictures

$
0
0

Hello.

 

Iwill like to know how I can reload a secuence of a item inside project. via scriptting .Thank you

 

If any could help me.

 

Reggards and sorry my bad english.

Find comp in the project

$
0
0

Hello guys. Simple question:

 

I have a layer (it's a composition layer) selected in the composition and I need to find it in the project window. How would I go about this? There are instances, when comps have the same name.

 

For now I have this code:

 

var curSelection = myComp.selectedLayers[0];     // gets a selected layer in timeline

for (var k = 1; k <= app.project.numItems; k++){     // loops through all items in the project

     var tempItem = app.project.item(k);

     if (tempItem.name == curSelection.name){        // checks if item(k).name is equal to selected layer

          var iNeedThis = app.project.item(k);

     }

}

 

however, this approach doesn't work if there are compositions/layers with the same name in the project.

 

Thank you.

selecting a control layer

$
0
0

Hi community ...

 

I am writing a script that end up with a control layer and some slider effects on it.

When the script is done to create all the stuff I wanted it to, the Master Control Layer should be selected and show all slider effects in the effect controls.

 

Without any "selection"code the layer is not selected after the creating progress. And when I select the layer by clicking on it, the layer gets selected and the effects appear in the effects controls.

 

 

I only find a code to select the layer by the script:

newNullControl.selected = true;

 

It works half way. The layer now is selected but the effects do not appear in the effect controls window.

 

 

How can I fix that? Any ideas?

 

THX, Andreas

javascript UI: folders?

$
0
0

Hi!

 

Is it possible to create a custom UI in After Effect with "folders" like this?:

 

Capture.PNG

 

At this moment I see only one way - is to "undock Panel" and add another Panel:

 

Capture1.PNG

But this isn't the way that I want to use...

 

Thank you in advance!

adding date to filename

$
0
0

I'm trying a to automatically add the date to an items name in the render queue.

 

I have the following.

 

var x = app.project.renderQueue.item(1).outputModule(1);  

alert (x.file.name);

 

This returns the name of the file that will be output but I'm unable to change this value. The scripting guide says this attribute is read/write but I can't figure out how to alter it.

 

Thanks.


Cannot prevent ExtendScript debugging while running scripts from After Effects

$
0
0

Hi,

 

I am facing this issue while running scripts from within After Effects. Whenever I am trying to run a script in After Effects, the script opens up in ESTK in the debug mode. The execution waits at the starting point of the script as if there is breakpoint even though there is none. I am not sure whether what I am missing, whether some debug flag needs to be reset etc. I am using After Effects CC on Windows 7 OS. Any help would be highly appreciated.

 

Thanks.

Drop Down List index - my script does not recognize the index line in my function

$
0
0

AE script Community-

 

I am a designer not a programmer so bare with me.  I'm just trying something simple, baby steps and I can't for the life of me to get this simple script to work.

 

I saw the script QUICK ADD and thought I would try to mimic this script for myself as a challenge.  I have watched David Torno's videos on Pro Video Coalition and made a simple Script UI from his example.  I searched for my answer on these forums here and tried to cobble together a simple script from the examples within these forums and can not get it to recognize the indices for my DROP DOWN LIST.  Here is my simple script:

 

{

function myScript(thisObj){

    function myScript_buildUI(thisObj){

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

       

        res = "group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\

                    groupOne: Group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'top'],\

                        myStaticText: StaticText{text:'New:'},\

                        myDropDownList: DropDownList{properties:{items:['Solid', 'Light']}},\

                },\

                    groupTwo: Group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'top'],\

                        myButton: Button{text:'Add'},\

                },\

                }";

       

        myPanel.grp = myPanel.add(res);

 

 

        //Defaults

        myPanel.grp.groupOne.myDropDownList.selection = 0;

              myPanel.grp.groupTwo.myButton.onClick = myButtonClick;

 

 

        //Setup panel sizing

        myPanel.layout.layout(true);

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

       

        //Make the panel resizeable

        myPanel.layout.resize();

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

                    

        return myPanel;

    }      

 

 

function myButtonClick() {

    var myComp = app.project.activeItem;

   

    if (myComp != null && myComp instanceof CompItem) {

 

 

        if (myPanel.grp.groupOne.myDropDownList.selection.index == 0){

               myComp.layers.addSolid([0,0,0],"MySolid", myComp.width, myComp.height, 1)

 

 

      } else if (myPanel.grp.groupOne.myDropDownList.selection.index == 2){

               myComp.layers.addLight("Light", [myComp.width/2, myComp.height/2]);

 

 

        }

    }

}

 

 

// Make floating window

    var myScriptPal = myScript_buildUI(thisObj);

   

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

        myScriptPal.center();

        myScriptPal.show();

    }

 

 

}

 

 

myScript (this);

}

 

 

If I comment out the lines

 

if (myPanel.grp.groupOne.myDropDownList.selection.index == 0){ and if (myPanel.grp.groupOne.myDropDownList.selection.index == 1){

 

the script will add the SOLID and the LIGHT.  But it will never work with these lines active - The ADD button does nothing.

 

I could just make use of the onChange with the drop down list, but I want to figure out how to connect onClick actions to the drop down list.

 

I copied this script piece from the forum and changed it to work with my script, but nothing seems to work:

 

buttonOne.onClick = onButtonOneClick;

function onButtonOneClick() {

     if (myPalette.dropdownlistOne.selection.index == 0) {

          // do this

     } else {

          // do this instead

     }

}

Can someone take a quick look at my top script and tell me why it will not work?  I've pretty much pulled out the last bit of hair I have over this - simple problem????

 

Thank you in advance.

Random Seed

$
0
0

Hi guys.

 

Is there any logical way how to implement Random Seed?

 

Curently I am using Math.random(), bus I'd like to have ability to control seed for that random. As far as I know random generator is based on current time in JavaSript (am I correct?) and theres no straight forward way to have a seed for that.

 

Any ideas?

 

Thank you.

Auto select an item in a child node of a TreeView UI control?

$
0
0

Hi There,


I'm having some issues with a TreeView control in my UI that I cannot seem to resolve, and thought I would ask if anybody here has done this type of thing.  My TreeView is made up of a collection of nodes, each with some child items.  When the window containing the TreeView displays, I populate it with the nodes.  I want to be able to script the selection within the TreeView, but I want the script to select a child items, not just their parent nodes.  Is this possible?  I know it is possible to selecting the parent nodes in a TreeView, but I cannot seem to get the code for selecting, via scripting, a child item of a node in a TreeView.  Any thoughts on how to acheive this?

 

Thanks for your time and help!

 

Best,
Arie

 

Here is some of the code I am using for auto-selecting child items of nodes in the TreeView:

 

 

                    //Code to populate the TreeView (picker) goes here

                    ...

 

                    //Highlight the last selection

                    for (var i=0; i < picker.items.length; i++)

                    {

                        if (picker.items[i].title == SAVED_TITLE){

                            picker.selection = picker.items[i];

                            picker.selection.expanded = true;

 

                            for (var x=0; x < picker.selection.items.length; x++) {

 

                                if (picker.selection.items[x].marker == SAVED_MARKER){

                                    picker.selection = picker.selection.items[x];  //turns out the indices are relative to it's parent, not the picker's indices

                                    break;

                                }

 

                            }

                       

                            break;

 

                        }

 

                    }

After Effects save location and ExtendScript

$
0
0

I am pretty new to After Effects scripting and I'm fairly new to the programming world (1+ years experience).

 

My question has multiple possible answers I guess, I'm looking for a way to have After Effects save its .aep file into a very specific predetermined location.  The reason I need this is because I'm currently in the process of writing scripts and tools to integrate After Effects and the rest of the Adobe products into our pipeline, so here's the general idea below:

 

The supervisor sets up a project / sequence / shot folder structure using tools built into the pipeline

The supervisor marks specific shots that will be done in After Effects (or perhaps an entire sequence or project)

The artist now comes in to work on their shot, they set their environment in the pipeline and the pipeline launches After Effects

The pipeline:

  • Creates AE file with a specific name and save location (maybe creates and automatically saves the file into the save location for the first time? Or perhaps it just opens a new folder and tells AE where to put it)
  • Creates compositions in the AE file that correspond directly to the shots being worked on
  • Imports footage / sequences (etc...), that the artist is subscribed to
  • Builds the render queue with the compositions it created
  • Sets the render locations for all of the compositions

The artist now gets to work doing their magic

The artist hits save (cmd+s, ctrl+s, etc...), After Effects saves the project file into the predetermined location under the predetermined name.

 

The above will only occur on the first time the artist goes to work on the shot.

Now in this setup I will either need scripts to tell After Effects what the name of the new file is going to be and where to save it, or perhaps I need to have the script generate a new AE file and place it in the proper location.  The other idea I had was to just create a blank After Effects file and have the scripts copy that file into the location it needs to go and rename it (this option is an avoid at all costs).

 

So my question is: is this possible?  Is it possible to have Extendscript directly create a blank AE file and save it into a specific location without user interaction?  Or perhaps simply tell AE where it is going to save the currently open file and what the file's name is going to be?  The idea is more or less that the artist shouldn't be worried about the file structure or where things are going to go, the pipeline is going to handle all of that.

 

Ideally I need this working on After Effects CS5 and greater, but CS6 and greater is fine too, we are pretty much moving to CS6 anyway.  Also, presently this needs to work on Mac computers, we have OSX 10.6.8 on most of the machines but we are going to be moving to 10.8 any day now, so preferrably it has backwards compatibility with 10.6.8 but not essential.

Viewing all 2143 articles
Browse latest View live


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