Javascript to save as template file in predetermined directory with prompt for filename.
I've seen a bunch of examples of how to save a regular illustrator file, but I can't seem to find the syntax for saving a file as a .ait file? Am i just missing something incredibly obvious here?? I know this is not right at all.. but this is what i was able to piece together from others' questions.. But i don't see where or how it calls out what kind of file it's saving..?
anyone care to explain the logic in the newName variable? i copied that directly from another post (and edited the file name at the end). What does "/ARTE\..{2,4}$/i" even mean?
I'd also like to suppress dialogs while saving as well.
thanks all.
var sourceName = app.activeDocument.name;
var dest = ('/Volumes/customization/library/cads/');
function saveAsTemplate(destination){
if(app.documents.length > 0){
var docRef = app.activeDocument;
var cadNumber = prompt("What's the number of this CAD?");
var newName = (sourceName.replace (/ARTE\..{2,4}$/i,'FD-SLOW-SS-' + cadNumber +'.ait');
var AIT = new File(destination);
docRef.saveAs(AIT);
}
} //end function
saveAsTemplate(dest);