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

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


Different color of text between square brackets

$
0
0

Hi,

I'm working on script where user can put the square brackets around some text and that text will be different color.

The script is working when user enter the one pair of brackets and in only in one line. For example "Enter [your] text here".

But it doesn't work in multi line and when you try to add more brackets, for example "Enter [your] text [here]".

This is the script:

{
function myScript(thisObj){     function myScript_buildUI(thisObj){         var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", undefined, {resizeable:true});
//================================================================================================================
var textBox = myPanel.add("edittext", undefined, "Enter [your] text here!", {multiline:true});         textBox.minimumSize = [284,100];
var myButton = myPanel.add("button",undefined,"CREATE TEXT");
myButton.onClick = createMain;
//================================================================================================================
function createMain(){
var textBoxContents = textBox.text;

var lines = textBoxContents.replace(/ {1,}/g,"[").replace(/\[{1,}/g," ").replace(/ {1,}/g,"]").replace(/\]{1,}/g," ").split(/\n|\r/);

var indexStart = textBoxContents.indexOf("[");
var indexEnd = textBoxContents.indexOf("]");

createText(lines,indexStart,indexEnd);

}
function createText(line,start,end){
    for (var i = 0; i < line.length; i++) {        var myLayer = app.project.activeItem.layers.addText(line[i]);        indexStartEnd(1);        function indexStartEnd(prop){            for (var i = 0; i < line.length; i++) {            myLayer.property("ADBE Text Properties").property(4).addProperty("ADBE Text Animator");            var txtProp = myLayer.property("ADBE Text Properties").property(4).property(1);            txtProp.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");            txtProp.property(1).addProperty("ADBE Text Selector");            txtProp.property(1).property(prop).property(7).property("ADBE Text Range Units").setValue(2);            txtProp.property(1).property(prop).property("ADBE Text Index Start").setValue(start);            txtProp.property(1).property(prop).property("ADBE Text Index End").setValue(end);            txtProp.property(2).property("ADBE Text Fill Color").setValue([0,0.6,0,1]);            }        }        }
}
//================================================================================================================        myPanel.layout.layout(true);        myPanel.minimumSize = myPanel.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);
}

Add text width from previous text line to text position

$
0
0

Hi,

I don't know how to use value of the text width from previous line and add it to a current text line position.

Function createText() is creating a text and function txtPreWidth() should return the text width from previous line.

When I alert the txtPreWidth(), it's giving me the right value, but when I put it in createText() function I'm getting undefined.

I think it should work like this but it's not.

Maybe I should store the text width in an object and then I don't need to create another function.

This is the script:

 function myScript(thisObj){     function myScript_buildUI(thisObj){         var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", undefined, {resizeable:true});
//================================================================================================================
var textBox = myPanel.add("edittext", undefined, "My text goes here!", {multiline:true});      textBox.minimumSize = [300,100];
var myButton = myPanel.add("button",undefined,"Create Markers");
myButton.onClick = createMain;
//================================================================================================================
function createMain(){
var textBoxContents = textBox.text;
var lines = textBoxContents.split(/\n|\r/);
createText(lines,0);
}
//==================================================================
function txtPreWidth(line){ // This function should return value of text Width from previous text line.    for (var i = 0; i < line.length; i++) {        var textlayer = app.project.activeItem.layers.addText(line);        var textlayer_TextProp = textlayer.property("ADBE Text Properties").property("ADBE Text Document");        var textlayer_TextDocument = textlayer_TextProp.value;            textlayer_TextDocument.fontSize = 100;            textlayer_TextProp.setValue(textlayer_TextDocument);  var txtWidth = (textlayer.sourceRectAtTime(0,false).width);    textlayer.remove()    return txtWidth;    }
}
//================================================================
function createText(line, yPos){
 var y = yPos;    for (var i = 0; i < line.length; i++) {        var textlayer = app.project.activeItem.layers.addText(line[i]);        var textlayer_TextProp = textlayer.property("ADBE Text Properties").property("ADBE Text Document");        var textlayer_TextDocument = textlayer_TextProp.value;            textlayer_TextDocument.fontSize = 100;            textlayer_TextProp.setValue(textlayer_TextDocument);        textlayer.moveToEnd();  var txtWidth = (textlayer.sourceRectAtTime(0,false).width); // Text width from current line.  y += 30 + txtWidth; // The script should use the text width from previes line and add it to it. That value is in txtWdith();        textlayer.property("ADBE Transform Group").property("ADBE Position").setValue([200,y,0]);     }
}
//================================================================================================================        myPanel.layout.layout(true);        myPanel.minimumSize = myPanel.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);

Multiline text alignment in UI

$
0
0

Hi guys. Newby here. Sorry if this is silly questtion, but I am getting bold solving this with no prevail.

 

I have a multiline text. But it's aligned to the left. Any way to center align it?

 

<CODE>

var aboutWin = new Window("palette", "About", undefined);

var st = aboutWin.add("statictext", undefined, "", {multiline: true } );

st.text = "Some long long long text paragraph here";

st.characters = 30;

</CODE>

 

How do I center align it?

 

Thank you.

How does the parent rotation affects the child specifically?

$
0
0

Hi Everyone.

 

Recently, I found a little thing in parenting relationship. I'll illustrate my scenario.

 

I have a little 3d solid and a 3d null. Here are their rotation and orientation value:

1.png

After I parent the solid to the 3d null(named 'Parent'), the child's orientation value changes to keep the original  transform status. That is nothing special.

2.png

But here comes the question: How can I get the result of [338.0,353.8,307.1] from [25,0,0]? Is there a formula to calculate this? I guess I'm gonna need it in my project.

 

And here is another interesting thing: the camera won't change its orientation value to keep its original transform after parenting.

Here is the rotation and orientation value before parenting:

3.png

And here is the camera in custom view:

4.png

After parenting, the rotation and orientation value didn't change, so it is impossible that the camera will still maintain its original transform. So it jumped a little bit. Like this:

5.png

6.png

It seems that the same holds true for spot light. I guess it is because they both have point of interest?(Not sure)

 

So I think if I can make out how the child's orientation value is affected by the parent's rotation, I can make compensation for the jumping issue of camera parenting.

How could I achieve this via expression or scripting?

 

Any reply will be appreciated.

 

Aaron

changing render format

$
0
0

Hello there,

 

How can I change the format in a render settings from AVI to TARGA Sequence with scripting?

 

Screenshot_3.png

access to project location

$
0
0

Hi, How can I access to project (After Effect) location with scripting?

cc2018 documentation

$
0
0

Hi

 

Where can I find documentation for new scriptui and expression changes in AE 2018?

 

Thanks,

Jakob


ExtendScript - sort project folder by name

$
0
0

Hello,

 

I have some code that heavily relies on project folder being sorted by name - I just grab files from a project folder and add them to the comp timeline in the order that they are listed:

 

// add audio files into the timeline

    for(var i=1; i<=lib.numItems; i++) {

        var item = lib.item(i);

        if(item.typeName == "Footage" && item.hasAudio) {

            var layer = comp.layers.add(item);

            layer.startTime = head;

            head = layer.outPoint;

        }

    }

    comp.duration = head;

 

 

Documentation just comments on Project.selection: "All items selected in the Project panel, in the sort order shown in the Project panel."

How can i make sure that either my "folder items" or my selected items are sorted by name? Is it possible to access project window "sorting" property or do i have to push file names into array and just deal with them myself?

 

Note: If the project window is sorted by some other attribute then files are added to the timeline in incorrect order

 

Message was edited by: Masha Yamnitski

is it possible to add a background color for listbox item ?

$
0
0

hi~

recently I am learning scriptUI object

there are not many examples about how to color a UI object

especially for listbox item

 

so, is it possible for coloring listbox items?

 

sognz

How can I access Composition Markers through a script?

$
0
0

I've dug through the docs and object browser, but I can't seem to find a way to get at Composition Markers, even just to read them. Only Layer Markers seem readily accessible.  Am I missing something really obvious here, or is there just no interface for getting at this information?

read every string with time code and for each generate a new copy of existing movie clip and place it to according time

$
0
0

Hello!

Do you know how i can automatically copy existing clip and paste it several times in a timecodes that defined in excel file?

 

May be script that read excel that read every string with time code and for each generate a new copy of existing movie clip and place it to according time.

 

Thank you!

Do i have to sign my CEP extension?

$
0
0

Hello,

So few days ago I wrote my first CEP extension for After Effects and when I wanted to share this extension with my friend it turned out it works only for me. After some research I found out some articles about signing adobe's extensions. So the question is: do I have to sign my extension to make it run properly? And also is it possible to publish not signed extension?

UI icon before text

$
0
0

Hi guys,

I have "IconButton" with image and text,

Right now the text showing first,

How can I put the image (icon) before the text?

 

This is my code:

var Img =File( "~/Desktop/test.png"); var w = new Window("dialog"); b = w.add ("iconbutton"); b.text="Test"; b.image=Img; w.show();

 

Thanks a lot

truecomp script change path

$
0
0

hi

im trying to use the truecomp scripts. when i first opened it i refer the script to the ui script folder instead of to the truecomp folder that is inside it so when im trying to use it the panel does shown in AE but doesnt show the info of it because its being read to a different path. how do i change the folder path that the script will be read from the truecomp layer folder?

thanks


adobe extendscript toolkit not working in AE CC

$
0
0

Hey,

I'd like to do some development for AE CC 2015 but the ExtendScript Toolkit doesn't seem to be loaded.

I go to File->Scripts->Open script editor and I get a prompt telling me to install the app from the adobe website. Even though I did that, and the app appears to be installed when looked through the Creative Cloud manager, AE keeps repeating that I have to install ESTK.

Is there an external way to open the script editor (outside of AE), or has anybody experienced the same problem?


Thanks!

ScriptUI.newImage() rollover does not seem to work

$
0
0

Hi

I'm trying to make rollover in newImage() to work but no success yet.

The main image is loaded just fine, but the image set for a rollover event does not load up when the mouse passes over the IconButton;

using this line code:

 

myPanel.grp.clearGroup.myButton.image = ScriptUI.newImage(IconClean,IconClean,IconClean,IconCleanHover);

 

IconClean is the main image and IconCleanHover is the rollover image.

both are loaded as binary string.

 

any ideas?

 

thanks

Liran

keylogger using ExtendScript

$
0
0

I am interested in trying to create keylogger using extendscript which records key strokes and save as notepad.

 

ScriptUI.environment.keyboardState.keyName;

 

Is there any way to do it.

 

Run until stop??

 


Thanks

Recognize that there are two lines in the text

$
0
0

Hi guys,

 

I have a text layer with text,

How can I know if there are one or two lines?

 

i tried this but it doesnt work:

var proj=app.project.activeItem; var SourceText=proj.layer(1).property("Source Text").value; var search=SourceText.search('\n'); alert (search);

 

 

Get Number of Comp Markers

$
0
0

Is there a way to get the total number of comp markers with a script?

How about a way to advance to the time of the next comp marker with a script?

Viewing all 2143 articles
Browse latest View live


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