// econ2_runner.jsx — runner for Doodle2 build script
(function () {
    try {
        app.preferences.savePrefAsLong(
            "Main Pref Section",
            "Pref_SCRIPTING_FILE_NETWORK_SECURITY",
            1,
            PREFType.PREF_Type_MACHINE_INDEPENDENT
        );
    } catch (e0) {}

    function writeLog(msg) {
        try {
            var f = new File("E:/Claude.app/ae-work/econ2_run.log");
            f.encoding = "UTF-8";
            f.open("w");
            f.write(msg);
            f.close();
        } catch (e1) {}
    }

    try { app.beginSuppressDialogs(); } catch (e2) {}
    try {
        app.newProject();
        $.evalFile(new File("E:/Claude.app/skills/script-to-doodle-animation/out-econ/econ2_build.jsx"));
        app.project.save(new File("E:/Claude.app/ae-work/econ2.aep"));
        writeLog("OK comps=" + app.project.numItems);
    } catch (e) {
        writeLog("ERROR: " + e.toString() +
            (e.line ? (" @line " + e.line) : "") +
            (e.fileName ? (" file=" + e.fileName) : ""));
    }
    try { app.endSuppressDialogs(false); } catch (e3) {}
})();
