These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Script problem/creation bookmark

paulkeyz
Registered: Jun 13 2011
Posts: 3

Hi,
 
I'm having strange problem when creating a bookmark within js code of a stamp.
(Idea is to create a bookmark to the page where stamp is posted)
 
Stamp has two user-entry fields, but that part working well..
 
but bookmark creation - doesn't do anything (no errors as well).
 
if(event.source.forReal && (event.source.stampName == "#bf"))
{
if ("ok" == app.execDialog(dialog))
{
var cMsg = dialog.LValue.substr(0,5);
event.value = cMsg;
cMsg = dialog.UValue;
this.getField("U").value = cMsg.substr(0,5);
console.println(event.target.doc.pageNum); //debug
event.target.doc.bookmarkRoot.createChild("qwerty", "this.pageNum=0", 0);
}
}
 
Any suggestions?
 

My Product Information:
Acrobat Pro
try67
Expert
Registered: Oct 30 2008
Posts: 2398
What error message are you getting? Do you see the debug line in the console?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

paulkeyz
Registered: Jun 13 2011
Posts: 3
I'm getting error:

InvalidGetError: Get not possible, invalid or unknown.
Doc.pageNum:63:App L:Calculate
try67
Expert
Registered: Oct 30 2008
Posts: 2398
I know the pageNum property is not available during batches. Maybe it's also not available during stamp events...
Try removing this line (it's just a debug line, no?), and see what happens.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

paulkeyz
Registered: Jun 13 2011
Posts: 3
hmm, I did so.

it is doing nothing - not creating any bookmark (with any destination).

that was my original question... (debug is obviously not important)
try67
Expert
Registered: Oct 30 2008
Posts: 2398
In the error message it says line 63, are you sure the piece of the code you pasted is the real place where the error happens?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com