Article View: adobe.scripting.indesign
Article #2640Re: Problem with File.copy() -- should this work?
From: Dave_Saunders
Date: Sat, 13 Dec 2008 02:41
Date: Sat, 13 Dec 2008 02:41
26 lines
1358 bytes
1358 bytes
On the plus side, this version works:
(function() {
var myFolder = Folder(getScriptPath().parent + "/disabled");
if (myFolder.exists) {
var myScripts = myFolder.getFiles("*.jsx");
for (var j = 0; myScripts.length > j; j++) {
var targ = File(myFolder.parent + "/enabled/" + myScripts[j].name);
if (myScripts[j].copy(targ)) {
myScripts[j].remove();
}
}
}
function getScriptPath() {
// This function returns the path to the active script, even when running ESTK
try {
return app.activeScript;
} catch(e) {
return File(e.fileName);
}
} // end getScriptPath
}())
I never did feel comfortable with relative paths.
Dave
Technical Details
Message-ID:
<59b741e0.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossingReferences:
<59b741e0.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,42a64b28108c0aee X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Problem with File.copy() -- should this work? Message-ID: <59b741e0.0@webcrossing.la2eafNXanI> Date: Fri, 12 Dec 2008 18:41:26 -0800 References: <59b741e0.-1@webcrossing.la2eafNXanI> Lines: 25 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit