File.rename on Mac :/
guys... have code, it works on windows perfectly renaming files.
i have tried make work on mac couldn't.
is doesn't display error / alert.
what doing wrong, why doesn't work on mac? :/
many in advanced x)
var filenameext = "sst"; var mainpath = folder.desktop + "/"; var fullpath = folder.desktop + "/new files/"; var f = file(mainpath + "ext.svg"); if (f.exists) { f.rename(fullpath + filenameext + ".svg"); };
that works correctly on windows?
/* both of below should work fine on os x, problem in line: f.rename(fullpath + filenameext + ".svg"); // path reference not needed, 'f' declares */ // option 1: var filenameext = "sst"; var mainpath = folder.desktop + "/"; // assumes svg file on desktop var f = file(mainpath + "ext.svg"); if (f.exists) { f.rename(filenameext + ".svg"); // error here, path reference not needed, 'f' declares } else { alert(f+ " not found"); } // option 2: var filenameext = "sst"; var fullpath = folder.desktop + "/new files/"; // assumes svg file on desktop, in folder 'new files' var f = file(fullpath + "ext.svg"); if (f.exists) { f.rename(filenameext + ".svg"); // error here, path reference not needed, 'f' declares } else { alert(f+ " not found"); }
hope helps efforts.
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment