Forum Replies Created

Page 4 of 24
  • This works on any selected items. So you’ll need to update for just footageItems, but hopefully this steers you in the right direction.

    If you can play around with it, I’d update to include undo group like you’ve got in yours, just because you have hit ctrl/cmd + z for every item it’s replaced otherwise, but this will do what you want if you’re just selecting footage layers anyways.

    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i).selected){
    var name = app.project.item(i).name;
    var width = 1920;
    var height = 1080;
    var framerate = 25;
    var duration = app.project.item(i).duration;

    app.project.item(i).replaceWithPlaceholder(name,width,height,frameRate,duration);
    }
    }

  • Scott Mcgee

    March 10, 2020 at 2:07 pm in reply to: get JSON key

    I’d personally array your subtitles and reference them this way

    var txt = footage("test2.json").sourceData;
    txt.language.dutch.titles[0]

    {
    "language": {
    "english": {
    "titles": [
    "My First Title"
    ]
    },
    "dutch": {
    "titles":[
    "Mijn eerste Titel"
    ]
    }
    }
    }

  • Scott Mcgee

    March 9, 2020 at 9:53 am in reply to: launch script eval(file.read()) palette or dialog

    Tomas on the adobe forums posted this and it appears to work, when doing a few tests with it.
    He said he couldn’t explain why it worked, just that it does.

    var w = new Window("palette", "script", undefined);
    var btn = w.add("button", undefined, "TEST");

    w.onResizing = function() {
    this.layout.resize();
    };

    w.show();

  • Scott Mcgee

    March 5, 2020 at 1:59 pm in reply to: launch script eval(file.read()) palette or dialog

    That makes sense.

    Cheers for that.

  • Scott Mcgee

    March 4, 2020 at 8:44 am in reply to: Word Split

    I can’t think of a tidier way to do this other than this then

    r = text.sourceText.split(“\r”);
    r[1].split(” “)[0]

    So your first [ ] is referring to line and the second [ ] is referring to word.

  • Scott Mcgee

    March 3, 2020 at 3:29 pm in reply to: Word Split

    Unless someone says differently.

    split(” “) splits based on a space gap. Because Rander is on the next line the space isn’t taken into account and you need to include a split(“\r”). I don’t know how to use multiple delimiters, but Regex will work

    text.sourceText.split(/\s/);

  • Scott Mcgee

    March 3, 2020 at 1:36 pm in reply to: extendscript: onClick add n sliders

    Hopefully this helps.

    I’ve added a safety net so that if you don’t add a number it won’t crash. It will just alert that a number hasn’t been added.

    Essentially what it is doing it. The layer or layers you’ve selected, it then runs a separate loop and adds based on the value of your text box.

    var win = new Window(‘palette’, “ADD SLIDERS”, undefined);
    var numOne = win.add(“edittext”,undefined,”ENTER NUMBER HERE”);
    var btn = win.add(“button”,undefined,”ADD SLIDERS”);

    btn.onClick = function(){

    var curItem = app.project.activeItem;
    var selectedLayers = curItem.selectedLayers;

    for (var j = 0; j < selectedLayers.length; j++) {
    var myLayer = selectedLayers[j];

    if(isNaN(numOne.text)){
    alert(“Enter a number”)
    }else{
    var num = parseInt(numOne.text);
    for(var i = 0; i < num; i++) {
    myLayer.Effects.addProperty(“Slider Control”)(“Slider”);
    }
    }
    }
    }

    win.show();

  • Scott Mcgee

    February 13, 2020 at 2:40 pm in reply to: increments for loop

    That was not fun, but if anyone is building a script to contain multiple rows. Here’s how to do it.

    I can’t be bothered tidying up further as I’ve already shaved 12 lines and it’ll now work for more and more row.

    var b = new Array();
    for(var i = 0; i <= 15; i++ ){
    var f = File (folder1[i].name);
    var str = "buttonsRow" + (Math.floor(i/5));
    var n = eval(str);
    b[i] = n.add ("iconbutton", undefined, f, {style: "toolbutton"});
    }

  • Scott Mcgee

    February 13, 2020 at 1:51 pm in reply to: increments for loop

    This is a bit neater to my original, but I still would rather have it as a few lines, but I can’t get it to work.

    var b = new Array();
    for(var i = 0; i <= 15; i++ ){
    var f = File ("/Volumes/Server/Video/CAPi RenderBot Source/Logos/"+folder1[i].name);
    if(Math.floor([i]/5) == 0){
    b[i] = buttonsRow0.add ("iconbutton", undefined, f, {style: "toolbutton"});
    }else if(Math.floor([i]/5) == 1){
    b[i] = buttonsRow1.add ("iconbutton", undefined, f, {style: "toolbutton"});
    }else if(Math.floor([i]/5) == 2){
    b[i] = buttonsRow2.add ("iconbutton", undefined, f, {style: "toolbutton"});
    }
    }

  • Scott Mcgee

    February 13, 2020 at 10:39 am in reply to: increments for loop

    I’m nearly there, but I’m struggling to pass the j

    var b = new Array();
    for(var i = 0; i <= 2; i++ ){
    var f = File (file.name)
    var j = Math.round(i/5)+1;
    b[i] = buttonsRow[j].add ("iconbutton", undefined,f, {style:"toolbutton"});
    }

Page 4 of 24

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