My current script below does everything I need it to do in the "Begin Create Faux Logo Comp" section. But won't execute the "Begin Set color of Text via Layer Styles" section of the script because the composition created in the previous section does is not open in the timeline. If I open the composition into the timeline manually and run the "Begin Set color of Text via Layer Styles" section of code by-itself it does what I need it to do.
I've tried a few things but just can't seem to get it to work.
Code: Select all
//-------*Begin What this script needs to do*---------------//
//To create Faux Logos:
//Create a folder named, Company Web Logo.
//Create a 200x70 (or 250x100) size composition inside of that folder.
//Add a basic black Text Layer with "Faux Logo" as the source text in the middle.
//-------*End What this script needs to do*---------------//
//-----------Begin Create Faux Logo Comp--------------//
function projectItem(name)
{
var items = app.project.items;
i = 1;
while (i <= items.length) {
if (items[i].name == name)
{
return app.project.item(i);
break;
}
i++;
}
}
app.project.items.addFolder("Company Web Logo");
var myComp = projectItem("Company Web Logo").items.addComp("Logo Comp", 200, 70, 1.0, 1.0, 25.0);
var mySolid = myComp.layers.addSolid( [255,255,255], "White Solid", 200, 70, 1.0,1.0);
var myText = myComp.layers.addText( "Faux Logo");
var halfcompW = 0.5*(app.project.item(2).width);
var halfcompH = 0.5*(app.project.item(2).height);
myText.transform.position.setValue([200,80]);
myText.transform.anchorPoint.setValue([halfcompW,halfcompH]);
//-----------End Create Faux Logo Comp--------------//
//-----------Begin Set color of Text via Layer Styles--------------//
var firstLayer = app.project.item(2).layer(1);
firstLayer.selected = true;
app.executeCommand(app.findMenuCommandId("Color Overlay"));
firstLayer.layerStyle.colorOverlay.color.expression = "layerStyle.colorOverlay.color = [0,0,0,1]";
//-----------Begin Set color of Text via Layer Styles--------------//
