質問
Export selected Movie Clips in library to PNGs and keep the name of the MC.
Hi I am trying to modify this script to export selected Movie Clips from library to PNGs and keep original name of the MC. I have the script that works well exporting selected bitamps from library, but I am trying yo modify it to export also Movie clips.
function exportLibraryImagesToFiles() {
var doc = fl.getDocumentDOM();
if (!doc) return;
var selectedItems = doc.library.getSelectedItems();
if (!selectedItems.length) return;
var folder = fl.browseForFolderURL("Choose an output directory.");
if (!folder) return;
var i, t, sym, bmpName;
var count = 0;
for (i = 0; i < selectedItems.length; i++) {
sym = selectedItems[i];
if (sym.itemType != "bitmap") {
continue;
}
bmpName = sym.name.split("/").pop();
// strip original extension
t = bmpName.lastIndexOf(".");
if (t != -1 && ["jpg", "jpeg", "png", "gif", "bmp", "psd"].indexOf(bmpName.substr(t + 1).toLowerCase()) != -1) {
bmpName = bmpName.substr(0, t);
}
// do the thing
sym.exportToFile(folder + "/" + bmpName + "." + (sym.compressionType == "photo" ? "jpg" : "png"));
count++;
}
alert(count + " image(s) exported.");
}
exportLibraryImagesToFiles();