Mark Paterson
Forum Replies Created
-
Oops. Made a copy / paste goof and unable to edit my post. There should also be a line at the top to create a text layer first. Amended script below.
var text = app.project.activeItem.layers.addText();app.project.activeItem.layer(1).text.sourceText.expression = "Numbers = 4; t =timeToFrames(time); c = t.toString().length; while( c < Numbers){ t = \"0\"+t; c++ } t";
app.project.activeItem.layer(1).position.expression = "[10,thisComp.height-13]";var textProp = text.property("Source Text");
var textDocument = textProp.value;
myString = "Timecode";
textDocument.resetCharStyle();
textDocument.fontSize = 40;
textDocument.fillColor = [1, 1, 1];
textDocument.strokeColor = [0, 0, 0];
textDocument.strokeWidth = 8;
textDocument.font = "Monaco";
textDocument.strokeOverFill = false;
textDocument.applyStroke = true;
textDocument.applyFill = true;
textDocument.text = myString;
textDocument.justification = ParagraphJustification.LEFT_JUSTIFY;
textDocument.tracking = 45;
textProp.setValue(textDocument);
textProp.setValue(textDocument); -
ok, no big deal. A minor inconvenience I can live with by adjusting the stroke and tracking slightly to compensate.
Thanks again, Dan. As a motion designer, I’ve lurked on this forum over the years and noted your many contributions. I’ve only started posting recently since deciding once and for all to learn Javascript/Extendscript, so it’s nice to get a problem solved by the man himself haha.
For anyone out there who’s interested in the final working script – this will add a 4 digit frame timecode to the bottom left of any size comp. You can execute this as a script or via a Script UI button.
app.project.activeItem.layer(1).text.sourceText.expression = "Numbers = 4; t =timeToFrames(time); c = t.toString().length; while( c < Numbers){ t = \"0\"+t; c++ } t";
app.project.activeItem.layer(1).position.expression = "[10,thisComp.height-13]";var textProp = text.property("Source Text");
var textDocument = textProp.value;
myString = "Timecode";
textDocument.resetCharStyle();
textDocument.fontSize = 40;
textDocument.fillColor = [1, 1, 1];
textDocument.strokeColor = [0, 0, 0];
textDocument.strokeWidth = 8;
textDocument.font = "Monaco";
textDocument.strokeOverFill = false;
textDocument.applyStroke = true;
textDocument.applyFill = true;
textDocument.text = myString;
textDocument.justification = ParagraphJustification.LEFT_JUSTIFY;
textDocument.tracking = 45;
textProp.setValue(textDocument);
textProp.setValue(textDocument); -
WOW. That is truly bizarre. Thanks so much for figuring it out, I was really pulling my hair out!!
Is there a way to specify All Strokes Over All Fills? I don’t see anything for it at https://docs.aenhancers.com/other/textdocument perhaps it is undocumented?
I’ve tried
textDocument.allFillsOverAllStrokes = true; -
Hiding that line has no effect I’m afraid. ☹
At this point I’m focusing on the script below (removing my Timecode parts). It’s based solely on the Adobe Scripting Guide version, and running it from the File menu. This way I can at least see error codes (vs Script UI where in most cases I do not).
I’ve changed a couple of values to make any changes obvious (font size, tracking), so even if I have the font name wrong, then surely the other changes would be apparent. Currently none of these changes actually change anything. Only thing I can control below is the paragraph justification.
var text = app.project.activeItem.layers.addText();
var textProp = text.property("Source Text");
var textDocument = textProp.value;
myString = "Happy holidays!";
textDocument.resetCharStyle();
textDocument.fontSize = 300;
textDocument.fillColor = [1, 0, 0];
textDocument.strokeColor = [0, 1, 0];
textDocument.strokeWidth = 2;
textDocument.font = "TimesNewRomanPSMT";
textDocument.strokeOverFill = true;
textDocument.applyStroke = true;
textDocument.applyFill = true;
textDocument.text = myString;
textDocument.justification = ParagraphJustification.CENTER_JUSTIFY;
textDocument.tracking = 200;
textProp.setValue(textDocument); -
I’ve also tried running the script (below) as a JSX using File > Scripts > Run Script File.
This time it’s exactly the same as the Adobe Scripting Guide one (as both “TimesNewRomanPSMT” and “Times New Roman PSMT”. Same issue – the text appears, but it’s still not styling anything!
var text = app.project.activeItem.layers.addText();var textProp = text.property("Source Text");
var textDocument = textProp.value;
myString = "Happy holidays!";
textDocument.resetCharStyle();
textDocument.fontSize = 60;
textDocument.fillColor = [1, 0, 0];
textDocument.strokeColor = [0, 1, 0];
textDocument.strokeWidth = 2;
textDocument.font = "TimesNewRomanPSMT";
textDocument.strokeOverFill = true;
textDocument.applyStroke = true;
textDocument.applyFill = true;
textDocument.text = myString;
textDocument.justification = ParagraphJustification.CENTER_JUSTIFY;
textDocument.tracking = 50;
textProp.setValue(textDocument); -
The original styling code is also available at https://docs.aenhancers.com/other/textdocument 3rd example from top. I’ve tried that same code and it still doesn’t work.
Also, I’m 99% sure that the PostScript name of the font is “Monaco” (according to Apple Font Book), which is a requirement of textDocument.font
-
Mark Paterson
November 22, 2019 at 8:43 pm in reply to: Unable to run aerender command over ssh using system.callSystem scriptThe following command works. Turns out I needed to backslash the quotes in a couple of places…
var renderCommand = "ssh server@192.168.50.4 \"/Applications/Adobe\\ After\\ Effects\\ 2020/aerender -project \"" + path;
system.callSystem(renderCommand);However, the issue now is that AE pinwheels until the aerender is complete on the other machine haha. The same happens when I remove ssh from the command and aerender locally. I guess I need to find a way to let it run in the background or just send the command then return focus to AE?
-
Mark Paterson
November 13, 2019 at 6:19 pm in reply to: How do I use scripting to select a ‘Render Settings’ template?That did it, thanks!
-
Try the 3rd Party Plugin “Magic Bullet For Editors” https://store.yahoo.com/redgiantsoftware/mbforeditors.html
It has some fantastic presets which are contained in a Final Cut Project file. You can just drag them into your clips and tweek them to your hearts content.
You can also go from scratch and create your own.