Yes, you can use this code to do it (as a doc-level script):
this.getField("pages").value = this.numPages;
Hi I don't get an error but also no figure is displayed in the field. Should I add anything else?
Remove the function definition.
I read a little more and found by combining your suggestion with another if I put this in calculate field box it worked:
Thanks for your help
First of all it's numPages, not numpages. Also, if you do it like that it won't update after you remove or add pages and then re-open the file...
Thanks in this case that is OK. I saw the typo but you can't edit posts unfortunately once added. I'm just posting this for me as a second point that to add a date this works:
event.value=util.printd("mm/d/yyyy", new Date());