1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include "Tools.jsx"
function Document_tools(){
}
/**
* function who package a document and his link
* @param the save dir path
* @return the new doc path
* @throw error if the package occured an error
**/
Document_tools.save_with_package = function(doc, directories_path_str) {
var result_package = false;
var current_date = new Date();
var folder_package = Folder (directories_path_str);
if (folder_package.exists == false) {
folder_package.create();
}
var doc_file = doc.fullName;
var current_folder = Folder (folder_package + "/" + Tools.format_date(doc_file.modified) + "_" + Tools.format_time(current_date) + "__" + doc.name);
current_folder.create();
/**bool packageForPrint (to: File, copyingFonts: bool, copyingLinkedGraphics: bool, copyingProfiles: bool, updatingGraphics: bool,
* includingHiddenLayers: bool, ignorePreflightErrors: bool, creatingReport: bool[, versionComments: string][, forceSave: bool=false])
**/
result_package = doc.packageForPrint(current_folder, false, true, false, true, false, true, false);
if(!result_package){
throw new Error("il y a eu un problème lors de l'assemblage");
}
return current_folder + "/" + doc.name;
} |
Partager