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

Merging multiple radio button groups for one possible result

$
0
0

Hey.

 

I have 3 groups each with two radio buttons in. I want only one button to checked at a time, but unfortunately you can still check one button from each group.

From looking online, I've read that they all need to have the same name in order to be part of the same 'radio group'. But no matter where I've put a

.name = "sameGroup"

it hasn't worked.

 

Is this possible? Or do I need to create an eventListener for each button, which unchecks all other buttons upon being clicked.

 

Here is an example of my code below:

 

var w = new Window("dialog", "test", undefined, {}); // create window
// create main group
var radGrpMain = w.add('Group', undefined);
radGrpMain.alignChildren = ['left', ' '];
radGrpMain.orientation = 'row';


// create left sub group
var radGrpL = radGrpMain.add('Group', undefined);
radGrpL.orientation = 'column';
// create mid sub group
var radGrpM = radGrpMain.add('Group', undefined);
radGrpM.orientation = 'column';
// create right sub group
var radGrpR = radGrpMain.add('Group', undefined);
radGrpR.orientation = 'column';

// add buttons
var rad1 = radGrpL.add("RadioButton", undefined, "Radio 1");
rad1.value = true; // default true.
rad1.name = "sameGroup";
var rad2 = radGrpL.add("RadioButton", undefined, "Radio 2");
rad2.name = "sameGroup";
var rad3 = radGrpM.add("RadioButton", undefined, "Radio 3");
rad3.name = "sameGroup";
var rad4 = radGrpM.add("RadioButton", undefined, "Radio 4");
rad4.name = "sameGroup";
var rad5 = radGrpR.add("RadioButton", undefined, "Radio 5");
rad5.name = "sameGroup";
var rad6 = radGrpR.add("RadioButton", undefined, "Radio 6");
rad6.name = "sameGroup";

w.show(); // show window

 

 

Any help appreciated!

 

James


Retrieving XMP metadata from After Effects Comp

$
0
0

Hi,

 

I've successfully retrieved XMP metadata from a custom Project schema. Like this:

 

var proj = app.project;

var customMetadataSet = "Starz";

var customMetadataField = "Episode";

 

if(ExternalObject.AdobeXMPScript == undefined) {

    ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

}

 

var metaData = new XMPMeta(proj.xmpPacket);

var schemaNS = XMPMeta.getNamespaceURI(customMetadataSet);

 

if(schemaNS == "" || schemaNS == undefined) {

    alert("no custom metadata named: " + customMetadataSet);

} else {

    var metaValue = metaData.getProperty(schemaNS, customMetadataField);

    if(!metaValue) {

        alert("no custom field named: " + customMetadataField + " In set: " + customMetadataSet);

    } else {

        alert(customMetadataField+ ": " + metaValue.value);

    }

}

Screen Shot 2018-03-01 at 4.29.55 PM.png

But now I have 2 questions.

  1. How do I get Project XMP metadata from Dublin Core or Basic set?
  2. How do I get XMP metadata from a selected Comp and the Dynamic Media set?

 

Thanks for any insight.

Kelly Anderson

Starz - A Lionsgate Company

 

Extendscript - Text layer alignment / anchorpoint

$
0
0

Hi Friends!

 

Neck deep building a script to batch out a bunch of numerical comps, wanting to set a text layer to be dead center. Have managed to get a justification param set and even user defined, however want to script the equivalent of using the align palette and selecting "Align Horizontally" and " Align Vertically"

 

Have tried to set the anchor point by inserting an expression onto the layer (via extend-script) which I've made work for an image layer, but sad times with a text layer - some of my research leads me to believe this wont work for text layers. Also tried sourceRectAtTime with no luck.

Hoping someone has some thoughts or solution for this as I'm turning out several hundred comps every time this script runs so manually setting this isn't an option.

 

Thanks!

Closing Windows Issue on Dockable Panel??

$
0
0

Hello After effects insane coders ...

 

I've been trying to resolve this issue for quite some time now. I've tried everything possible, but I can not get any kind of feedback when "myWindow" is closed.

I need to be able to make modifications and save some changes when the user closes the main window or simply when it closes After Effects.


I need to be able to close all other windows that are open when closing "myWindow".

I'm trying this with the onClose function on line 89.

But the function returns no result.

 

I would also like to be able to save some data when the user closes After Effects, as I can not detect when "myWindow" is closed ... I also can not save this data.

 

Below is my complete code ...

I'm almost giving up...

If some charitable soul can help me, I thank you deeply ...

 

Thanks for all...

 

Rubens

 

 

 

 

 

(function(thisObj) {


var scriptPalette = scriptBuildUI(thisObj);
if (scriptPalette !== null && scriptPalette instanceof Window) {
scriptPalette.center();
scriptPalette.show();
} else {
scriptPalette.alignment = ["center","center"];
scriptPalette.alignChildren = ["center","center"];
scriptPalette.layout.layout(true);


}


scriptPalette.onResize = function(){scriptPalette.layout.resize (); }  


function scriptBuildUI(thisObj) {
   
var myWindow = (thisObj instanceof Panel) ? thisObj : new Window("window", "WINDOW TEST", undefined, {name: "WINDOW TEST", resizeable: true}); // HA_replaced prefs.script.name with "WindowName"
//myWindow.borderless = true;
myWindow.margins = [5,0,0,0];
myWindow.alignChildren = ["center","center"];
myWindow.alignment =  ["center","center"]; 




var mainGRP = myWindow.add("group", undefined, "mainGroup", {borderless: true});
    mainGRP.orientation = "column";    mainGRP.alignment = ["center","center"];     mainGRP.margins = [0,0,0,0];    mainGRP.spacing = 0;    mainGRP.visible = true;            var headerGRP = mainGRP.add("group", undefined, "mainGroup", {borderless: true});    headerGRP.orientation = "column";    headerGRP.alignment = ["center","center"];     headerGRP.margins = [0,0,0,0];    headerGRP.spacing = 0;    headerGRP.visible = true;    headerGRP.borderless = true;           var mainButton = headerGRP.add("button", undefined, "Main Header");    mainButton.text = "Click to open new window"    mainButton.alignment = ["center","center"];     mainButton.margins = [0,0,0,0];    mainButton.bounds = [0,0,200,200];            mainButton.onClick = function(){ second_Win.show();}    




var second_Win = new Window("palette", "", undefined, {closeButton: true});     second_Win.orientation = "column";    second_Win.maximumSize.height = 700;  second_Win.maximumSize.width = 300;  second_Win.margins = [10,10,10,20];  second_Win.spacing = 0;     var second_Win_headerGRP = second_Win.add("group", undefined, "mainGroup", {borderless: true});    second_Win_headerGRP.orientation = "row";    second_Win_headerGRP.alignment = ["center","center"];     second_Win_headerGRP.margins = [0,0,0,0];    second_Win_headerGRP.spacing = 0;    second_Win_headerGRP.visible = true;    second_Win_headerGRP.borderless = true;        var secondWindowButton = second_Win_headerGRP.add("button", undefined,  "second window")    secondWindowButton.text = "This is the second window"    secondWindowButton.alignment = ["center","center"];     secondWindowButton.margins = [0,0,0,0];    secondWindowButton.bounds = [0,0,200,200];        second_Win.onClose = function(){ alert("SECOND WINDOW IS CLOSING")};    myWindow.onClose = function(){ second_Win.close(); alert("MAIN WINDOW IS CLOSING")};


return myWindow




} //UI Creation End.//




return
})(this);    

Script to pull in a local image to project panel keeps forcing new project - I'd like to import to current project

$
0
0

Hey guys,

 

Script newbie here and would appreciate any help.

 

The current script - which was previously used in Photoshop by someone else - imports a downloaded image (location) to the project panel.

 

function OpenDocument(location) { return app.open(new File(location)); }

 

Right now a selected image is downloaded via a panel (Pixabay image API). It downloads fine and then is immediately seen in the project panel, but either a new untitled project has been created automatically (if current project is saved), or I get the "Save changes to 'untitled project' before closing?" prompt.

 

Any ideas would be greatly appreciated. I'll be honest, I don't completely understand what the code is doing - just hunches. I simply want the downloaded image to appear in the project panel of current project - no questions asked.

Is there a method or function to list all the properties

$
0
0

I'm looking for a method that's similar to Python's dir(x) which lists all the properties of an object. I'm looking to use this on After Effects Objects.

Display the location of an item in a project.

$
0
0

I have multiple text layers and fonts in my project. In various comps.
I want to be able to scan through the project and then show all of the locations that a specific font is used.

 

I used for loops for all the scanning and am able to get that far, but i want to display a list of all of the places a font is used. Any help is appreciated.

 

My goal is to get an alert box with something like:

 

Font used in:

1. ThisComp > This Layer

2. ThisComp > This Layer

3. ThisComp > This Layer

4. ThisComp > This Layer

etc.

What is the Best Marketplace for Sales? (Inquiry)

$
0
0

Hello insane coders.

 

I am finalizing a commercial purpose script and am trying to decide which is the best marketplace for sales.


1 - My first option is Envato, since it's the only one that has its data open and I can see that there are people actually making money there.

 

2 - I wonder if any of you sell through the Adobe Exchange platform. If so, do you actually make a profit? For despite having 90% of profit from sales to the producer, sales volume is unknown.

 

3 - Aescripts does not tell the producer% or the sales volume, could anyone tell me?

 

4 - Is there any other option even better than the ones I quoted above?

 

 

I hope this inquiry helps me and also helps other coders decide how best to make money from our hard work.

 

Thank you.


Font search naming

$
0
0

Hello,

Im making progress on a script to search for fonts. Someone types a font in, and it shows them where its used.
Though, is there a way to have the user only need to type in "Arial" instead of "Arial-MTBold" or other versions of weight and italics. I would prefer to only search by the family i guess.

 

 

Thanks!

re: "Undefined" Value and Unable to Cancel in Script Prompt

$
0
0

Every time I run my script, there is an "undefined" value in the text field by default. Also, clicking cancel does not actually terminate the script; it moves on to the next part of the code (below).

 

 

script_prompt_01.jpg

 

script_prompt_02.jpg

 

var copies = parseFloat(prompt("Please enter number of copies (1 - 99): "));

 

while (copies < 1 || copies > 99 || isNaN(copies) ) {


copies = parseFloat(prompt("Please enter a numerical number between 1 and 99: "));


}

 

Any feedback why this behavior is happening? I've just recently been digging into AE scripting and am probably overlooking something obvious about the cancel function.

 

Thanks.

re: Batch Processing Output Module File Path with Folder Dialog Box

$
0
0

I'm trying to write a variation of David Torno's batch processing of file paths in the render queue but with a dialog box to prompt the user. https://www.provideocoalition.com/after-effects-extendscript-training-ep-5/  ~ 42:37.


However, the selectDialog method doesn't return a compatible parameter for a new File. Is there an alternate method or way to convert/extract the full directory path from it?

 

var oldName;   

   

     var newPath = Folder.selectDialog("Please select render output directory: ");  

     

     for (var o = 1; o <= renderQ.numItems; o++) {

          

          oldName = renderQ.item(o).outputModule(1).file.name;

          

          renderQ.item(o).outputModule(1).file = new File(newPath + oldName);     

         

}

 

Error_01.jpg

 

Any suggestions would be helpful. Thanks.

FootageItem.replace with layered PSDs

$
0
0

Hey guys,

I'm trying to change the source location of all the psds in my project to the same files located in another directory. Unfortunately, when I try to use FootageItem.replace to do this and I have several footage items that source from the same psd (as different layers from that psd), each of those items just turn into the full psd, rather than staying as the individual layers.

Hope that makes sense.

 

Any solutions?

bypass mouseout addEventListner while rendering or isWatchfolder ????

$
0
0

Hello insane coders..

 

I'm having problems with my script.

The addEventListner (mouseout) is completely locking my script when I try to render or access any external folder.

 

The error message is:

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

 

Does anyone know if there is a way to include some kind of condition (if / else) for the mouseout to work only if:


          app.isWatchFolder == false && app.isRenderEngine == false

 

As the addEventListner (mouseout) function is built-in.

I am not finding a solution to define a condition for its operation. If anyone has any idea that works, I thank you very much ...

 

Rubens Nobre

Get layer duration from dropdownlist selected layer

$
0
0

Hello there,

 

I'm currently diving into after effects scripting, and I'm kinda baffled trying to get the layer's duration from a selected layer in a dropwdownlist.

I've got this so far:

 

function CreateSLwindow ()
{    var slWin = new Window("palette", "Split Layers", undefined);        var panelOne = slWin.add("panel", undefined, "Split Layers");    var slMainGroup = panelOne.add("group", undefined, undefined);    var getTimeGroup = slMainGroup.add("group", undefined, undefined);    getTimeGroup.orientation = "column";    var slTimeTextA = getTimeGroup.add ("statictext", undefined, "1. Select in comp the layers to split");    var slTimeTextB = getTimeGroup.add ("statictext", undefined, "2. Select a Reference layer for time");    var sltimeLayer = getTimeGroup.add("DropdownList", undefined, GetAllLayers());        sltimeLayer.selection = 0;    var goSlTime = getTimeGroup.add("button", undefined, "Do it!");    var infoSLBtn = slWin.add("button", undefined, "About tool");            slWin.layout.layout(true);    slWin.center();    slWin.show();    slWin.onResizing = slWin.onRize = function()     {        this.layout.resize();    };    goSlTime.onClick = function ()    {        SplitLayersFunctionality();    }
}


function GetAllLayers (galyrs)
{
    var allComp = GetCurrentComp();    var lyrsList = new Array();    if(!(allComp instanceof CompItem))        return null;    for(var i = 1; i<=allComp.numLayers; i++)    {        lyrsList[lyrsList.length] = allComp.layer(i).name;    }    return lyrsList;
}


function SplitLayersFunctionality ()
{
    var slFuncComp = GetCurrentComp();    var layersSLF = slFuncComp.selectedLayers;    var refSLFlayer = sltimeLayer.selection.outPoint - sltimeLayer.selection.inPoint;    var durationValue = parseFloat(refSLFlayer); //THIS HAS TO BE SELECTED REFERENCE LAYER;      if (slFuncComp == null)    {        alert("Please, select a comp");    }    else    {        app.beginUndoGroup("Splite Layers setup");        for (var i = 0; i < layersSLF.length; i++)        {            //divide selected layers length by reference layer length            layersSLF[i].outPoint = layersSLF[i].inPoint + (durationValue / layersSLF.length);            /*if(i == 0)            {                //Not working               layersSLF[i].inPoint = 0.0;            }*/            if (i != 0)            {                layersSLF[i].inPoint = layersSLF[i-1].outPoint;            }        }        app.endUndoGroup;    }
}

 

The line "var refSLFlayer = sltimeLayer.selection.outPoint - sltimeLayer.selection.inPoint;" is not working. I tried to add the complete path "slWin[...].sltimeLayer.selection.outPoint; but it's not working.

I think there's somewhere a missing parameter to get the selected layer item saved, but I didn't figure that out.

 

Is there any hint on how to achieve this?

Thanks in advance

re: Unable to Display Full Comp Names in Render Queue Output Path

$
0
0

It's getting late and I've been scratching my head on this one for a bit.

 

In a nutshell, I'm unable to batch rename an output path when there is no previous name to reference.

 

I tested an alert with oldName and it displays the full comp name fine, including periods and spaces, but they go away once the new File is created.
02.jpg
00.jpg
01.png

I tried converting oldName.toString() to see if it preserves the spaces but that didn't work.


How to check if a internal modal dialog is open?

$
0
0

Hey Folks,

 

I am using a app.scheduleTask as an interval to look if the contents of a folder have changed in the background.

 

This works well enough but if the user opens up an internal modal dialog (e.g. compositions settings), AE throws an error:

modalDialogError.jpg

I have not been able to find any system event or variable to check if AE is currently busy with a modal dialog.

At the moment the user needs to restart the complete script, since the error stops the script from further execution.

 

Is there any option to check for modal dialogs?

Otherwise app.scheduleTask is pretty flawed as it causes every script to break if the user enters a modal dialog.

 

Cheers,

Matthias

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?

Save a json file content inside a variable

$
0
0

I have this url https://marketplace.envato.com/api/edge/audaciousleap/mnk79e4cztu4sgbyjqbzp... . I need to get that text. I have no idea how to do that, and it seems that it could be so simple. I have searched a lot through the web but found no real solution. Almost all involved jQuery, and i don't think that works with extendscript. The closest i got was this, but i got an error for direct ip not allowed.

 

reply = "";

conn = new Socket;

if (conn.open("marketplace.envato.com:80")) {

    // send a HTTP GET request

    conn.write("GET /api/edge/audaciousleap/mnk79e4cztu4sgbyjqbzpje0j8v914n0/verify-purchase:2acfeef0-a573-47 97-91bb-1b85855e7f62.json HTTP/1.0\n\n");

    // and read the server’s reply

    reply = conn.read(999999);

    alert(reply);

    conn.close();

}

 

 

I have this example from javascript tools guide CC at page 194.. The original code was:

 

reply = "";

conn = new Socket;

// access Adobe’s home page

if (conn.open ("www.adobe.com:80")) {

     // send a HTTP GET request

     conn.write ("GET /index.html HTTP/1.0\n\n");

     // and read the server’s reply

     reply = conn.read(999999);

     conn.close();

}

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?

Help me to Move a image to another composition using Extendscript

$
0
0

HI,

 

I'm new to Extendscript Just now i start to lean. I like to know how Move a image to another composition using Extendscript in after effects

i need move my logo.png to your logo comp,

 

please provide the script according to my image..

 

Picture.png

 

thanks for the help

Senthuran

Viewing all 2143 articles
Browse latest View live


Latest Images

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