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);
}
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);
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.
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:
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:
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?
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
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?
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.
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?
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?
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?