Hi all,

This isn't a question related to the web, but it's Javascript so I am hoping someone might be able to assist. I am trying to create a dynamic stamp in Adobe which requires me to write Javascript for a textbox control. The stamp has two text boxes that I need to fill from one string. The string is in the format of
"08363-G-5109-DWG-R-00001_A.pdf" with a varying number of characters before the underscore, but always the same after the underscore. In the first text box I need
08363-G-5109-DWG-R-00001 which I get with
event.value = event.source.source.documentFileName.slice(0,-6);
this works great. The second box needs to contain the letter after the underscore, in this case 'A' The code that I have found that relates to getting this value doesn't seem to work. I am a VBA programmer I suspect that the logic is dfferent in Javascript.

var str = event.source.source.documentfilename;
var strt = str.lastindexof("_");
var end = str.lastindexof(".");
event.value = str.substring(strt,end);
Any assistance would be greatly appreciated!