Skip to main content
Inspiring
July 19, 2016
Answered

How to remove the "Author" value and write a new author name

  • July 19, 2016
  • 1 reply
  • 406 views

Hello,

I'm a dummy with scripting. I hope some experts can help me.

I'm working with FM11 and extendscript.

Now we have to insert metadata into the file info like "Author", "Title", "Keywords",....

As far I found the way to do it!

#target framemaker

var doc = app.ActiveDoc; 

var info = doc.PDFDocInfo;

var doctype = prompt("Possible cases: Installation manual, Operation manual, Installation and operation manual, Installer reference guide, User reference guide, Installer and user reference guide","Installation manual","Please input the type of manual");

info.push ("Author"); 

info.push (doctype); 

doc.PDFDocInfo = info;

Imagine that I run the script again, fill in a new entry in the inputbox, then the new entry does NOT overwrite the existing entry in the FM document.

Can somebody tell me (in dummy javascript language and step-by-step), how I can solve this issue for me?

Kind regards

This topic has been closed for replies.
Correct answer jessevic

This is the solution!

var doc = app.ActiveDoc;

var info = doc.PDFDocInfo;

var info=new Strings();

var doctype = prompt("Possible cases: Installation manual, Operation manual, Installation and operation manual, Installer reference guide, User reference guide, Installer and user reference guide","Installation manual","Please input the type of manual");

info.push ("Author"); 

info.push (doctype); 

doc.PDFDocInfo = info;

As test I wrote something in the Author field, I re-run the script and put another value into the inputbox. Result is that the original/wrong entry was deleted and/or overwritten with the new one.

1 reply

jessevicAuthorCorrect answer
Inspiring
July 19, 2016

This is the solution!

var doc = app.ActiveDoc;

var info = doc.PDFDocInfo;

var info=new Strings();

var doctype = prompt("Possible cases: Installation manual, Operation manual, Installation and operation manual, Installer reference guide, User reference guide, Installer and user reference guide","Installation manual","Please input the type of manual");

info.push ("Author"); 

info.push (doctype); 

doc.PDFDocInfo = info;

As test I wrote something in the Author field, I re-run the script and put another value into the inputbox. Result is that the original/wrong entry was deleted and/or overwritten with the new one.