Insert PDF Filename to Document Title
I am trying to apply some JavaScript via the Acrobat DC Action Wizard using the Execute JavaScript tool to automatically insert the filename of the PDF into the document title field (without the ".pdf"). I found a chunk of script and pasted it in, but I get the following error:
SyntaxError: illegal character
3: at line 4
The full code:
/* Put script title here */
\r\n//Begin script
\r\n\r\nvar strFilename = "";
\r\nvar strChar;
\r\nvar i = this.path.length;
\r\n\r\ndo {\r\nstrChar = this.path.substr\(i-1,1\)
\r\n//console.println\(strChar\);
\r\nstrFilename = strChar + strFilename;
\r\ni--;\r\n}
\r\nwhile \(strChar != "/"\)
\r\nstrFilename = strFilename.substring\(1,strFilename.length-4\);
\r\n\r\nthis.title = strFilename;
\r\n\r\n//End script\r\n).
I don't know enough coding to understand where the illegal character is.
