Forum Replies Created

Page 1 of 2
  • I’ve solved it. I’m sharing the code block. Maybe it can help.

    var selectAiFiles = File.openDialog([“Select scene *.ai file”], [“Illustrator:*.ai”], [true]);

    for (var i = 0; i < selectAiFiles.length; i++) {

    var importAiFiles = new ImportOptions(File(selectAiFiles[i]));

    if (importAiFiles.canImportAs(ImportAsType.COMP_CROPPED_LAYERS)) {

    importAiFiles.importAs = ImportAsType.COMP_CROPPED_LAYERS;

    var aiComp = app.project.importFile(importAiFiles);

    aiComp.name = selectAiFiles[i].name.slice(0, -3);

    var layerNamesArr = new Array();

    var layerIndexArr = new Array();

    for (var k = 1; k <= aiComp.numLayers; k++) {

    if (k == aiComp.numLayers) {

    break;

    }

    var tempNameArr = [aiComp.layers[k]];

    var tempIndexArr = [k];

    for (var l = k + 1; l <= aiComp.numLayers; l++) {

    if (aiComp.layers[k].name.slice(0, 2) == aiComp.layers[l].name.slice(0, 2)) {

    tempNameArr.push(aiComp.layers[l]);

    tempIndexArr.push(aiComp.layers[l].index);

    }

    }

    var isContiune = false;

    if (layerNamesArr.length >= 1) {

    var checkIndex = layerNamesArr.length - 1;

    for (var c = 0; c < layerNamesArr[checkIndex].length; c++) {

    if (layerNamesArr[checkIndex][c].name === aiComp.layers[k].name) {

    isContiune = true;

    }

    }

    }

    if (isContiune) {

    continue;

    }

    layerNamesArr.push(tempNameArr);

    layerIndexArr.push(tempIndexArr);

    }

    }

    function makePreComposeIndexArray(count, content) {

    var result = [];

    for (var i = 0; i < count; i++) {

    result.push(content(i));

    }

    return result;

    }

    for (var v = 0; v < layerIndexArr.length; v++) {

    var preComposeIndexArr = layerIndexArr[v];

    if (v !== 0) {

    preComposeIndexArr = makePreComposeIndexArray(layerIndexArr[v].length, function(i) {

    return i + v + 1;

    });

    }

    aiComp.layers.precompose(preComposeIndexArr, layerNamesArr[v][0].name, true);

    }

    /* for (var d = 1; d <= aiComp.numLayers; d++) {

    aiComp.layer(d).copyToComp(mainComp)

    } */

    }

    }; var selectAiFiles = File.openDialog(["Select scene *.ai file"], ["Illustrator:*.ai"], [true]); for (var i = 0; i < selectAiFiles.length; i++) { var importAiFiles = new ImportOptions(File(selectAiFiles[i])); if (importAiFiles.canImportAs(ImportAsType.COMP_CROPPED_LAYERS)) { importAiFiles.importAs = ImportAsType.COMP_CROPPED_LAYERS; var aiComp = app.project.importFile(importAiFiles); aiComp.name = selectAiFiles[i].name.slice(0, -3); var layerNamesArr = new Array(); var layerIndexArr = new Array(); for (var k = 1; k <= aiComp.numLayers; k++) { if (k == aiComp.numLayers) { break; } var tempNameArr = [aiComp.layers[k]]; var tempIndexArr = [k]; for (var l = k + 1; l <= aiComp.numLayers; l++) { if (aiComp.layers[k].name.slice(0, 2) == aiComp.layers[l].name.slice(0, 2)) { tempNameArr.push(aiComp.layers[l]); tempIndexArr.push(aiComp.layers[l].index); } } var isContiune = false; if (layerNamesArr.length >= 1) { var checkIndex = layerNamesArr.length - 1; for (var c = 0; c < layerNamesArr[checkIndex].length; c++) { if (layerNamesArr[checkIndex][c].name === aiComp.layers[k].name) { isContiune = true; } } } if (isContiune) { continue; } layerNamesArr.push(tempNameArr); layerIndexArr.push(tempIndexArr); } } function makePreComposeIndexArray(count, content) { var result = []; for (var i = 0; i < count; i++) { result.push(content(i)); } return result; } for (var v = 0; v < layerIndexArr.length; v++) { var preComposeIndexArr = layerIndexArr[v]; if (v !== 0) { preComposeIndexArr = makePreComposeIndexArray(layerIndexArr[v].length, function(i) { return i + v + 1; }); } aiComp.layers.precompose(preComposeIndexArr, layerNamesArr[v][0].name, true); } } };

  • Emre Mutlu

    July 29, 2022 at 6:27 am in reply to: Join seperate mask paths together via ExtendScript

    I’ll try it. Thank you Andrei.

  • Emre Mutlu

    July 29, 2022 at 6:20 am in reply to: How to find system name of font

    Thank you Dan and Filip.

  • Thank you very much guys. I was having trouble to change style of the text box which i’ve added but figure it out too. I’m adding my code here too. Looks like you should use TextDocument object to modify the style of text box.

    var titleLayer = mainComp.layers.addBoxText([1250,500]);

    // Title Text Properities ///////////////////////////////////////////

    var titleTextDoc = new TextDocument(“Test Text”);

    titleLayer.property(“Source Text”).setValue(titleTextDoc);

    var textProp = titleLayer.property(“Source Text”);

    titleTextDoc = textProp.value;

    titleTextDoc.fontSize = 50;

    titleTextDoc.text = title;

    titleTextDoc.fillColor = [1,0,0];

    titleTextDoc.justification = ParagraphJustification.CENTER_JUSTIFY;

    textProp.setValue(titleTextDoc);

  • Emre Mutlu

    July 1, 2022 at 7:28 am in reply to: Importing file by using the script file’s path

    Looks like it’s a bug. I have delete the file and copy again and it works. Thank you.

  • Thank you very much. This has been extremely helpful.

  • Thank you Dan. I tried your way and it worked.

    I was talking about scripting. I post here because can’t find a scripting topic. How could i do it with script? Could you please explain the logic in this so that i can understand it 🙂 Also is there a way to create the mask point without using pen tool?

  • Emre Mutlu

    August 25, 2021 at 11:47 am in reply to: Reducing Frame Rate?

    Thanks for your replies and your time guys.

  • Emre Mutlu

    May 31, 2021 at 6:38 pm in reply to: Prores 4444 Color Problem

    Do you mean disabling “Use Display Color Management”? If so i’ve tried with it but couldn’t figure it out.

    What’s the proper way of doing this? I’m sending my project also.

  • Emre Mutlu

    June 8, 2020 at 7:01 pm in reply to: Move CTI by script?

    Thank you very much Dan.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy