Skip to main content
Participant
April 27, 2011
Answered

Script to put the path of the File in an illustrator document

  • April 27, 2011
  • 1 reply
  • 1585 views

I was able to figure out how to embed the Date and File Name, now im looking to embed where the file is located within my folder structure on the document. is this possible?

This topic has been closed for replies.
Correct answer Muppet_Mark-QAl63s

var pointTextRef = app.activeDocument.textFrames.add(); pointTextRef.contents = app.activeDocument.fullName.toString(); //pointTextRef.contents = app.activeDocument.path.toString(); pointTextRef.top = -1200; pointTextRef.left = 10;

Using '.toString()' should sort that… You will have to remember to run your script there are no events like document save/close that a script can act upon in this app…

1 reply

Muppet_Mark-QAl63s
Inspiring
April 27, 2011

var doc = app.activeDocument; alert(doc.fullName);

Will give you the full path to file…

alert(doc.path);

Will give to parent directory…

Participant
April 27, 2011

if i use the variable fullName it puts in the word "file" if i use path i get the word "folder" this is much closer than i have been able to get in the past though.

// CODE BEGIN

var pointTextRef = app.activeDocument.textFrames.add();

pointTextRef.contents = app.activeDocument.path;

pointTextRef.top = -1200;

pointTextRef.left = 10;

// CODE END

Edit: P.S. Thank you for your help!

I should add one more question, I want to make a template for Customer Proofs and have the folder name embed automaticly when it is saved, purpose being: when I or another person look at the hard copy of the proof they can find what folder it was saved in, is this possible or do i have to actively run this this script every time i use the template?

Muppet_Mark-QAl63s
Muppet_Mark-QAl63sCorrect answer
Inspiring
April 27, 2011

var pointTextRef = app.activeDocument.textFrames.add(); pointTextRef.contents = app.activeDocument.fullName.toString(); //pointTextRef.contents = app.activeDocument.path.toString(); pointTextRef.top = -1200; pointTextRef.left = 10;

Using '.toString()' should sort that… You will have to remember to run your script there are no events like document save/close that a script can act upon in this app…