Make Editable Text via Script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
fabiantheblind
Posts: 7
Joined: December 27th, 2010, 11:33 pm

Hi folks,

I'm working on a script that executes a menue command to make editable text from my PSD file.
this is my code so far:

Code: Select all

main();

// here it happens
function main(){
    
// get the current active composition
var curComp = app.project.activeItem;

// if ther is no comp
	if (!curComp || !(curComp instanceof CompItem))
	{
		// alert and end the script
	    alert("Please select a Composition.");
	    return;
}
// start undogroup
app.beginUndoGroup("main");

    for (var i = 0; i < curComp.selectedLayers.length; i++) 
    {
        //layers.push(sellayers[i]);
        var l = curComp.selectedLayers[i];
        var tl = l.source.layers[1];
        tl.selected = true;
        app.executeCommand(app.findMenuCommandId("In editierbaren Text umwandeln"));

    
        }

    //end undogroup
app.endUndoGroup();
}
When i run

Code: Select all

        app.executeCommand(app.findMenuCommandId("In editierbaren Text umwandeln"));
directly in my comp it works. But when i go thru the selectedLayers.source it won't.
When i open the comps the first layer (which is the text layer) is selected but not converted.

Where is my mistake?
Do I have to bring the comp to the front or something like this?
And if so, how do I do that?

Best :fabian
Post Reply