Question
Script ran via actions does not select properly
Dear community,
I've written a small script which transforms text to outline and afterwards unites the paths via pathfinder. This works as intended when ran via File > Scripts. However, when I run the script via an action the text-path group isn't selected and thus pathfinder doesn't work.
var docRef = app.activeDocument;
var textFrames = docRef.textFrames;
// Failsafe
if (textFrames.length != 0) {
text_to_path_and_unite(textFrames);
}
// Text to path and unite path
function text_to_path_and_unite(textFrames) {
while (textFrames.length != 0) {
// Deselect all layers
app.executeMenuCommand("deselectall");
// Select text && transform to path
textFrames[0].selected = true;
textFrames[0].createOutline();
// Unite path via pathfinder
app.executeMenuCommand("group");
app.executeMenuCommand("Live Pathfinder Add");
app.executeMenuCommand("expandStyle");
}
}
Any suggestions on how to select the text-path group is appreciated.
Thanks in regards.
