Hi folks,
Thank you for your input on this, I almost have it working. I tried all the solutions above and the closest I could get was with:
Code:
var arrStr="08363-G-5109-DWG-R-00001_A.pdf".split('_');
var arrstr2 = arrStr[1].split(".");
event.value = arrstr2[0];
which gave me my desired result 'A', but requires that the string be inserted in the javascript each with each document opened.
Code:
var arrStr = event.source.source.documentfilename.split("_");
var arrstr2 = arrStr[1].split(".");
event.value = arrstr2[0];
and
var str = event.source.source.documentfilename;
var arrStr = str.split("_");
var arrstr2 = arrStr[1].split(".");
event.value = arrstr2[0];
but this works to display the whole string:
var str = event.source.source.documentfilename;
event.value = str;
the results weren't produced in either case. I did find some info on what I am trying to do and it seems there are limitations to consider which (I think) is why the function calls fell over.
Limitations from ->
http://acrobatusers.com/tutorials/pr..._stamp_secrets
"There is only one serious limitation to a dynamic-stamp script. Stamp files do not execute JavaScript like a normal PDF file. For example, there are no document or page events. Variables and functions cannot be defined in a document script. The only scripts guaranteed to execute are the calculation scripts of the fields placed on the stamp. Everything necessary to execute this script must be present in the script.
Another, less-important limitation is that the event.rc value is meaningless in a dynamic stamp calculation script. It doesn’t block the field from acquiring the assigned value as it would in a normal calculation script."
Hopefully ya'll like a challenge, thanks for your time and input!
Bent