#!/usr/bin/env osascript -l JavaScript

function run(ufo_paths) {

  for (let ufo_path of ufo_paths) {

    app = Application("Glyphs");
    doc = app.open(ufo_path);
    font = doc.font;
    ttf_path = ufo_path.replace(".ufo", ".ttf");

    console.log("[OPENED IN GLYPHS]", ufo_path);

    // for (let gid in font.glyphs) {
    //   console.log(gid);
    //   glyph = font.glyphs(gid);
    //   glyph.production = glyph.name;
    // }

    console.log("[EXPORTING TO TTF]", ttf_path);

    font.instances[0].generate({
      to: ttf_path,
      as: "TTF",
      withProperties: {
        autohint: false,
        removeoverlap: true,
        usesubroutines: false,
        useproductionnames: false,
      },
    });

    doc.save();
    doc.close();

  }
}

@@ -285,208 +285,8 @@
 );%0A%0A
-    // for (let gid in font.glyphs) %7B%0A    //   console.log(gid);%0A    //   glyph = font.glyphs(gid);%0A    //   glyph.production = glyph.name;%0A    // %7D%0A%0A    console.log(%22%5BEXPORTING TO TTF%5D%22, ttf_path);%0A%0A
     
@@ -314,16 +314,16 @@
 erate(%7B%0A
+
       to
@@ -449,28 +449,27 @@
 ubroutines: 
-fals
+tru
 e,%0A        u
@@ -528,16 +528,16 @@
 save();%0A
-
     doc.
@@ -546,14 +546,63 @@
 ose();%0A%0A
+    console.log(%22%5BEXPORTED TO TTF%5D%22, ttf_path);%0A%0A
   %7D%0A%7D%0A

Update generate_ttf.js