Hi,
When I want to split the text by line, I'm using:
myText.split(/\n|\r/);
I'm using Windows and to split the text by empty line I'm using:
myText.split('\n\n');
and it's works fine on Windows.
Can anyone tell me will it work on a Mac?
Thanks
Hi,
When I want to split the text by line, I'm using:
myText.split(/\n|\r/);
I'm using Windows and to split the text by empty line I'm using:
myText.split('\n\n');
and it's works fine on Windows.
Can anyone tell me will it work on a Mac?
Thanks
Hi guys!
How to know the Path to the selected property?
//
var sL=app.project.activeItem.selectedLayers[0].selectedProperties[0];
alert(sL.name);
//
As Above expression gives out selectedProperty Name.
How to know the Path to the property?
For Example if selected Property of layer "a" is position then output will be
thisComp.layer("a").transform.position;?
is there a to find ALL keyframes from a layer, without having to specify a property?
for instance, Layer 1 might have keys on Position while Layer 2 might have keys on Rotation - ideally i'd like to be able to find both without having to specifically look at Position or Rotation properties.
assume there is a EditText
type some words
then hit "enter", the cursor will go to the new line
after that , I want let it make another "enter"
go to another newline
is it possibel ?
Hello,
Here's the situation - I've been brought into the middle of project that involves creating Comps which contain 1 or more type layers horizontally aligned into a single line of type which scrolls left to right. The source for the text comes from text files, 1 text file per Comp. Essentially they are famous quotes or short passages with an author at the end. The type style, canvas size, default type size and other info comes from the script using a template comp. It also attaches a couple different sliders to change the scale of the font or its scrolling speed, but in this case they don't seem to be needed. It also sets the work area of the comp file it creates to the length of the animated scrolling text.
There are several hundred text files/comps that need(ed) to be created. I was handed off a script that would do this one text file/comp at a time. Obviously that was going to be a lot of tedious work to execute one at a time. I was able to take the script and replace it looking for a text file with the ability to be pointed at a folder, where it moves through the files in one long, looping process.
However I'm working quickly on somewhat tight timeline so I didn't want to change anything I didn't have to. I've run the script and as I said it processed most of what I need to, except for a few exceptions where it hit some problems. I guess if anyone can help me work out why this script works the way it does, and how I could make it a little more flexible, that would be fantastic. I can hack things together ok, but I'm not very experienced at scripting.
I've tried looking for examples of other scripts working this way, but I haven't found anything that handles this process in this manner. There isn't anything in the comments either, so if any of you recognize it or know where it came from I'll happily credit the original author in the source.
This is already a long post so here's the main part without the file reading and such... As I said, its reading in files from folders and everything fine after I modified a few things, like emptying out some variables that weren't meant to loop.
for (var i = 0; i < phrases.length; i++) {
myNextPhrase = phrases[i];
myLayer.text.sourceText.setValue(myNextPhrase + ".");
tempRect = myLayer.sourceRectAtTime(0, false);
nextPhraseLen = vert ? tempRect.height : tempRect.width;
if (curLen + nextPhraseLen > longPhraseMax) {
longPhrases[longPhrases.length] = myLongPhrase;
myLongPhrase = myNextPhrase;
} else {
myLongPhrase += myNextPhrase;
}
myLayer.text.sourceText.setValue(myLongPhrase + ".");
tempRect = myLayer.sourceRectAtTime(0, false);
curLen = vert ? tempRect.height : tempRect.width;
}
if (myLongPhrase.length > 0) {
longPhrases[longPhrases.length] = myLongPhrase;
}
for (var i = 1; i < longPhrases.length; i++) {
myLayer.duplicate();
}
var tempTextDoc;
var tempTextLen;
var mySlider1;
var mySlider2;
var blankCount;
var blankIdx;
var tempLongPhrase;
var totalWidth = 0;
for (var i = 1; i <= longPhrases.length; i++) {
myLayer = myComp.layer(i);
// temporarily replace ending blanks with printing character
blankCount = 0;
blankIdx = longPhrases[i - 1].length - 1;
while ((longPhrases[i - 1][blankIdx] == " ") && (blankIdx >= 0)) {
blankCount++;
blankIdx--;
}
tempLongPhrase = longPhrases[i - 1].substr(0, longPhrases[i - 1].length - blankCount);
for (var j = 1; j <= blankCount; j++) {
tempLongPhrase += "^";
}
myLayer.text.sourceText.setValue(tempLongPhrase);
tempTextDoc = myLayer.text.sourceText.value;
tempTextLen = tempTextDoc.text.length;
tempRect = myLayer.sourceRectAtTime(0, false);
mySlider1 = myLayer.property("Effects").property("**** internal 1");
mySlider2 = myLayer.property("Effects").property("**** internal 2");
if (vert) {
mySlider1.property("ADBE Slider Control-0001").setValue(tempRect.top);
mySlider2.property("ADBE Slider Control-0001").setValue(tempRect.height);
totalWidth += tempRect.height + 1;
} else {
mySlider1.property("ADBE Slider Control-0001").setValue(tempRect.left);
mySlider2.property("ADBE Slider Control-0001").setValue(tempRect.width);
totalWidth += tempRect.width + 1;
}
myLayer.text.sourceText.setValue(longPhrases[i - 1]);
}
var myScale;
if (vert) {
myScale = myComp.layer(1).property("Scale").valueAtTime(0, false)[1];
} else {
myScale = myComp.layer(1).property("Scale").valueAtTime(0, false)[0];
}
var myPPF = myComp.layer(1).property("Effects").property("Pixels Per Frame").property("ADBE Slider Control-0001").value;
var myDur = ((totalWidth * Math.abs(myScale) / 100 + myComp.width) / myPPF + 2) * myComp.frameDuration;
if (myDur > myComp.duration - 2) {
myDur += 2;
myComp.duration = myDur;
for (var i = 1; i <= myComp.numLayers; i++) {
myComp.layer(i).outPoint = myDur;
}
}
myComp.workAreaStart = 0;
myComp.workAreaDuration = myDur;
When it does get stuck, its here at "myComp.workAreaDuration = myDur; " where it hits the max allowed. I'm not entirely sure about everything it's doing, since I'm coming into this a little late in the pipeline. I think I get the gist of what its doing breaking type into word chunks and putting them together into rectangles, but I don't get the upper bounds. If anyone can break it down a little for me or better yet can see why it might have issues with long files, then please let me know. Again I don't know what this was being used for originally or where it came from so I'm not sure whats needed.
Thanks!
I have progress indicator - counter.
var counter = new Window("palette"); counter.prompt = counter.add("statictext",[0,0,180,20]); counter.prompt.text = "Script is running";
In my script i have cycle "for"
for (i = 8; i <= NumOfStrings; (i = (i + 5))) { в counter.prompt.text = ("Processed " + i+" / " + NumOfFrames + " frames"); counter.update(); // Main operations of "for" cycle }
So, the problem is:
Counter not updating as planned (1/10, 2/10, 3/10, ... 10/10)
Counter acts 1/10 -> 10/10.
So its not update value. How to fix it?
I am looking for someone to help me write a simple batch-render script. I will pay. Please start a discussion with me and I will be waiting for anyone's reply.
First come, first serve.
Thanks.
I'm setting up a workflow for the Templater plug-in but I need to get markers from the base video file which gets dynamically replaced.
When you drag a video (that was exported from Premiere) into Ae, it automatically shows layer markers for any markers you set in Premiere.
But when Templater dynamically replaces this footage, the markers do not get updated.
So I need an expression – or script? – that will grab the markers from a given MOV file and either save their timecodes to a file (JSON, text, CSV, whatever) or apply those markers to the right layer in Ae (before Templater renders.)
Just to be clear ... I need to read the markers from the QuickTime .mov file -- NOT from the Premiere app!
Can someone help me get started on this? Or know of something similar I can use as a starting point?
At work we have a workflow that is as following:
- we prerender a comp
- place that prerender back in that comp
- solo it.
We prefer this above replacing the comp with the prerender, since it's much easier to make alterations.
Problems arise when you have 100 pre-comps which you render out overnight and you have to do with task over and over again for all the comps. It just takes a lot of time.
I was wondering how hard it is to make a script that checks the names of the pre-comps and compares that to the comps. If it's the same, then put the pre-comp in the first layer and solo it. My scripting skills are limited to copy/pasting exsisting scripts and I can read and understand not too complex scripts.
Hi guys,
I'm adding a text layer and i'm trying to change a FONT but it's doesnt work.
How can I make it works?
this is my code:
{
var proj=app.project.activeItem;
var myTextLayer=proj.layers.addText();
var textProp = myTextLayer.property("Source Text");
var textDocument = textProp.value;
textDocument.font = "Arial";
textDocument.text = "Hello world";
textProp.setValue(textDocument)
}
I wanted to purge memory and disk via script. I used this code:
app.purge(PurgeTarget.ALL_CACHES);
app.purge(PurgeTarget.UNDO_CACHES);
app.purge(PurgeTarget.SNAPSHOT_CACHES);
app.purge(PurgeTarget.IMAGE_CACHES);
To my surprise this didn't clear the cache. I deduced that from going to Edit->Purge->All Memory and Disk Cache where I was greeted with the message that a couple of GB will be cleared if I proceed.
On the other side, there was a bug in AE that caused AE crash on every second render of the same exact project. Running the code above resolved the issue.
So what does app.purge() really do?
I have a script that generates a text file.
I can save it just fine, but I need to be able to also copy it to the system clipboard.
It needs to work on whatever platform a user happens to be on: Windows, Mac, etc.
How do you do this in an AE script?
Thanks
Hi,
I've been working a few hours on this with no luck, maybe anyone here can help:
I have an issue on Mac with a script where I want to transcode some files using ffmpeg.
Here's what's going on:
var cmd = pathToFFMpegBin + '/ffmpeg -h'; var output = system.callSystem(cmd); alert(output);
This works well, the command is executed and the alert shows the help for ffmpeg
But with the full command line to encode a file, like:
var cmd = pathToFFMpegBin + "/ffmpeg -h -i " + inputFilePath + " -c pcm_f32le " + outputFilePath; var output = system.callSystem(cmd); alert(output);
After Effects freezes (with the mouse cursor being the waiting cursor) like it's stuck in an endless loop
The alert is not shown, the script is stuck at the callSystem line.
BUT: the encoding does work, the new file is created and working...
- The same command works well in a terminal or as a bash script.
- The script works well in Windows
- If I provide a invalid path to the input file or the output file, it works as expected (the alert shows the error returned by ffmpeg)
- If I set ffmpeg to quiet mode (using the '-v quiet' option), it still don't work.
- I tried creating and executing a bash script, but I can't use File.execute() as it opens the script in a editor (even after I have set it to executable, that's normal behavior on Mac). I have to execute it via a callSystem('./file') and this freezes After Effects too.
- I tried launching the script via ExtendScript toolkit, both After Effecst and ExtendScript toolkit freeze, and I cannot stop the script in ES Toolkit.
- Tested on CC2017 and CC2015, same result.
- Javascript debugging is enabled, but I don't have any debug info, it's really like the script is in an endless loop, except I can't stop it.
Any idea? Or do you think about a workaround?
Oh and the ffmpeg binary was the snapshot build here: wihttps://evermeet.cx/ffmpeg/ the one recommended by the official ffmpeg website.
I still have to test with another version.
Hi There,
I'm running into an issue on macOS when passing strings with UTF-8 characters into the system.callSystem() method. I'm using AE 15.1.1 and macOS 10.13.5. On Windows, this test code works fine.
This is the very simple and basic code I'm using within the ESTK:
var cmd = "echo 'Does this character work? => x'" $.writeln(cmd) system.callSystem(cmd)
Here are some test strings and the results as listed in the ESTK Javascript Console window.
1.
Test string
"echo 'Does this character work? => x'"
ESTK Javascript Console Result
echo 'Does this character work? => x' Result: Does this character work? => x
2.
Test string
"echo 'Does this character work? => ©'"
ESTK Javascript Console Result
echo 'Does this character work? => ©' Result: Does this character work? => ÔøΩ
3.
Test string
"echo 'Does this character work? => ב'"
ESTK Javascript Console Result
echo 'Does this character work? => ב' Result: Does this character work? => ?
4.
Test string
"echo 'Does this character work? => Ă'"
ESTK Javascript Console Result
echo 'Does this character work? => Ă' Result: Does this character work? => ?
5.
Test string
"echo 'Does this character work? => ”'"
(note that this is a closed curly quote)
ESTK Javascript Console Result
None. Both ESTK hangs until the "stop button" is pressed. When the "run button" is pressed again, ESTK reports a very strange error, then and AE and ESTK freeze and require a force quit:
After Effects error: NSInvalidArgumentException: *** [__NSArrayM InsertObject:atIndex:]: object cannot be nil
As you can see above, in some cases the character is returned perfectly. In other cases, the character is shown as a question mark, and then in others it crashes both ESTK and AE.
Does anybody have any information as to why this happens? Am I missing something in either my code or my OS config? Any help is appreciated!
Thanks!
Hello, I'm fresh new in ExtendScript... and I'm trying to solve one question for days...
Can anybody help me to set value of "Scale" inside a
> Text layer > Text > Animator 1 > Scale??
I'm trying this but is not working...
app.project.item(1).layer(2).property("Text").text.animator("Animator 1").property("Scale").setValue([150,150])
Thanks !
Hello
I would like to know how to make a template.
And one of the questions I have, is how I do so that a composition that I have animated with an image inside, this can be replace in premier keeping the animation.
There are a lot of flavors of answer to this out there, none of which seem to work for me. Let me say right off the bat that my terminal (I'm running Yosemite) recognizes neither '-cmd' nor '-run' nor '-r'.
So, here is the breakdown:
1. I am able to launch AE from the terminal.
2. I am able to open an AE file from the terminal.
~Here is where it gets tricky~
3. I am able to open ExtendScript Toolkit from the terminal, although I would rather not have to involve this app at all, and just automatically run the script.
4. I am able to open my .jsx file in ExtendScript Toolkit from the terminal, although, again, I would rather not have to open ExtendScript Toolkit at all.
5. I am not able to run the .jsx file from the terminal.
How do I do this? Thanks!