ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Duplicating an Applescript App With ExtendScript

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Breton Brander
Duplicating an Applescript App With ExtendScript
on May 4, 2019 at 1:55:46 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?







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)))
}

}

}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]