This worked just fine in Acrobat Pro 9 but doesn't work in X. What gives?
i hate acrobat x. getting stupid errors , missing sorts of metadata functionality. can't browse (nevermind edit) metadata in explorer, , see no solution anywhere on net.
i used javascript in acrobat 9 no problems. in acrobat x syntax error missing ( before condition 8: on row 9 , can't proceed. different javascript in 9 changed in x, , find these changes?
/* filename metadata (title, author) */
var fname = this.documentfilename;
var deliminator = " - "
var lookfor = fname.lastindexof(deliminator);
// splice components
if lookfor = -1
{
var string1 = fname.slice(lookfor + deliminator.length, fname.length).replace(/.pdf/gi, "")
}
else
{
var string1 = fname.slice(fname, lookfor)
var string2 = fname.slice(lookfor + deliminator.length, fname.length).replace(/.pdf/gi, "")
}
// insert values
this.info.title = string1
this.info.author = string2
this should not work @ because have errors in code, in line:
if lookfor = -1
it should be:
if (lookfor == -1)
another error you're defining string1 , string2 within 1 block of code, , try access them outside of it. variable scope error , cause assing "undefined" values title , author properties.
More discussions in JavaScript
adobe
Comments
Post a Comment