• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save an illustrator file name containing the date and names of the links

Explorer ,
Mar 28, 2022 Mar 28, 2022

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.

TOPICS
Scripting

Views

642

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Mar 29, 2022 Mar 29, 2022

Give this a try:

https://github.com/wdjsdev/public_illustrator_scripts/blob/master/save_doc_with_date_and_link_names.js

 

//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
...

Votes

Translate

Translate
Community Expert , Mar 29, 2022 Mar 29, 2022
//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
...

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Hi @aviel222, I reckon it would help if you gave us a few examples of filenames.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2022 Mar 28, 2022

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2022 Mar 28, 2022

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

Give this a try:

https://github.com/wdjsdev/public_illustrator_scripts/blob/master/save_doc_with_date_and_link_names....

 

//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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 29, 2022 Mar 29, 2022

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2022 Mar 29, 2022

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

LATEST

Thank you!!!
If so, you can please resolve another of my unanswered requests:


https://community.adobe.com/t5/illustrator-discussions/print-document-without-click-quot-print-quot-...

 

I suggest $ 30 tip to whoever solves this first.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines