Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Duplicating an Applescript App With ExtendScript

  • Duplicating an Applescript App With ExtendScript

    Posted by Breton Brander on May 4, 2019 at 1:55 am

    Hi all,
    I’m trying to duplicate an Applescript application using ExtendScript. (video example below)

    My code is working well enough to copy all the files that the Applescript app contains and make a duplicate somewhere else, but the process of copying the files, breaks my Applescript app.

    When I open the package contents of my newly copied app file, some of the file types are a different format, and this is what’s causing my duplicated app to break.

    Does anyone know how to fix this issue of my files taking on the wrong file format after they’re duplicated?

    https://www.youtube.com/embed/Sq3M5s427B8

    var appleScriptFolder = "File path to my app"; //Path to folder where app is stored
    var appleScriptName = "nameOfMyApp.app" // Name of your app
    var appFile = appleScriptFolder + "/" + appleScriptName;
    var newLocation = "File path to new location" + "/" + appleScriptName // where do you want the dup file to go?

    copyScripts(appFile, newLocation)

    function copyScripts (fromHere, toHere) { //fromHere and toHere are strings of folder paths, not file/folder objects

    var myScripts = Folder(fromHere).getFiles();

    for (var i=0; i<myScripts.length; i++) {
    var thisScript = myScripts[i];

    if (thisScript.name.match(/ds_store/i)) continue;

    //If the main folder contains subfolders, this runs the whole thing again, recurseively
    if (thisScript instanceof Folder) {
    var copiedFolder = Folder(toHere + "/" + File.decode(myScripts[i].name));
    copiedFolder.create();
    copyScripts (Folder.decode(myScripts[i].fsName), toHere + "/" + File.decode(myScripts[i].name));
    continue
    }

    if (thisScript instanceof File) {
    thisScript.copy(File(toHere + "/" + File.decode(myScripts[i].name)))
    }

    }

    }

    Breton Brander replied 7 years ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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