Copy link to clipboard
Copied
Hi
I'm looking for a script that every time I run it, it will write to me when saving the file the current date (no = . _ = yes), and with spaces the names of the links that exist in the document.
Give this a try:
//Author: Dilliam Wowling
//email: illustrator.dev.pro@gmail.com
//github: github.com/wdjsdev/public_illustrator_scripts
//Adobe Forum Post: https://community.adobe.com/t5/illustrator-discussions/save-an-illustrator-file-name-containing-the-date-and-names-of-the-links/td-p/12842255
//Language: javascript/extendscript
//Script Name: Save Doc With Date And Link Names
//deSCRIPT
...
//Author: Dilliam Wowling
//email: illustrator.dev.pro@gmail.com
//github: github.com/wdjsdev/public_illustrator_scripts
//Adobe Forum Post: https://community.adobe.com/t5/illustrator-discussions/save-an-illustrator-file-name-containing-the-date-and-names-of-the-links/td-p/12842255
//Language: javascript/extendscript
//Script Name: Save Doc With Date And Link Names
//deSCRIPTion: Saves the current document with a date and the names of the links in the document.
//Was this helpful?
//Did it sa
...
Copy link to clipboard
Copied
Hi @aviel222, I reckon it would help if you gave us a few examples of filenames.
- Mark
Copy link to clipboard
Copied
there is example:
29_3_22 345432 34343 4987654
the 345432 34343 4987654 are the names of the links.
aviel
Copy link to clipboard
Copied
another example:
3_3_22 cc.pdf ee.pdf
important to remove the periods from the file name = 3_3_22 cc ee
aviel (from my work place)
Copy link to clipboard
Copied
Give this a try:
//Author: Dilliam Wowling
//email: illustrator.dev.pro@gmail.com
//github: github.com/wdjsdev/public_illustrator_scripts
//Adobe Forum Post: https://community.adobe.com/t5/illustrator-discussions/save-an-illustrator-file-name-containing-the-date-and-names-of-the-links/td-p/12842255
//Language: javascript/extendscript
//Script Name: Save Doc With Date And Link Names
//deSCRIPTion: Saves the current document with a date and the names of the links in the document.
//Was this helpful?
//Did it save you time and money?
//Would you like to say thanks by buying me a cup of
//coffee or a new car or anything in between?
//https://www.paypal.me/illustratordev
#target Illustrator
function SaveDocWithDateAndLinkNames()
{
const doc = app.activeDocument;
//get the current date formatted like this: dd-mm-yyyy
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var curDate = dd+'_'+mm+'_'+yyyy;
//get the links in the current document
var links = doc.placedItems;
var linkNames = [];
for(var i = 0; i < links.length; i++)
{
linkNames.push(decodeURI(links[i].file.name).replace(/\.[^\.]*$/, ""));
}
var newFileName = curDate + " " + linkNames.join(" ") + ".ai";
var outputFolderPath;
if(!doc.saved || doc.name.match(/untitled/i) || !doc.path)
{
outputFolderPath = decodeURI(Folder.selectDialog("Select the folder to save the file to").fullName);
}
else
{
outputFolderPath = decodeURI(doc.path);
}
if(!outputFolderPath)
{
alert("No folder selected.\nOperation cancelled.");
return;
}
doc.saveAs(File(outputFolderPath + "/" + newFileName));
}
SaveDocWithDateAndLinkNames();
Copy link to clipboard
Copied
Thank you!
Can you put in command code that will embed the links
After saving, then again automatically save the file?
Copy link to clipboard
Copied
//Author: Dilliam Wowling
//email: illustrator.dev.pro@gmail.com
//github: github.com/wdjsdev/public_illustrator_scripts
//Adobe Forum Post: https://community.adobe.com/t5/illustrator-discussions/save-an-illustrator-file-name-containing-the-date-and-names-of-the-links/td-p/12842255
//Language: javascript/extendscript
//Script Name: Save Doc With Date And Link Names
//deSCRIPTion: Saves the current document with a date and the names of the links in the document.
//Was this helpful?
//Did it save you time and money?
//Would you like to say thanks by buying me a cup of
//coffee or a new car or anything in between?
//https://www.paypal.me/illustratordev
#target Illustrator
function SaveDocWithDateAndLinkNames()
{
const doc = app.activeDocument;
//get the current date formatted like this: dd-mm-yyyy
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var curDate = dd+'_'+mm+'_'+yyyy;
//get the links in the current document
var links = doc.placedItems;
var linkNames = [];
for(var i = 0; i < links.length; i++)
{
linkNames.push(decodeURI(links[i].file.name).replace(/\.[^\.]*$/, ""));
}
var newFileName = curDate + " " + linkNames.join(" ") + ".ai";
var outputFolderPath;
if(!doc.saved || doc.name.match(/untitled/i) || !doc.path)
{
outputFolderPath = decodeURI(Folder.selectDialog("Select the folder to save the file to").fullName);
}
else
{
outputFolderPath = decodeURI(doc.path);
}
if(!outputFolderPath)
{
alert("No folder selected.\nOperation cancelled.");
return;
}
doc.saveAs(File(outputFolderPath + "/" + newFileName));
for(var i = 0; i < links.length; i++)
{
links[i].embed();
}
doc.save();
}
SaveDocWithDateAndLinkNames();
Copy link to clipboard
Copied
Thank you!!!
If so, you can please resolve another of my unanswered requests:
I suggest $ 30 tip to whoever solves this first.