Article View: adobe.scripting
Article #37Acrobat JavaScript DataObjects
From: gtrfrk213
Date: Thu, 17 Feb 2005 17:02
Date: Thu, 17 Feb 2005 17:02
25 lines
2017 bytes
2017 bytes
I am trying to read in a counter number from a file, add one to that
counter, and write the new one back to that file. Right now, I have a
file called "c" sitting next to my pdf. It is prompting me to find the
file, and again name it when i export the value. I dont think i'm
getting the value out of the dataobject right. Here is my code:
//get value from file
this.createDataObject("c", "0");
this.importDataObject("c");
//var d = this.dataObjects;
//get int value out & inc
var newc = parseInt(this.getDataObject("c"));
newc++;
//set value to Counter field and export
this.getField("Counter").value = newc;
this.exportDataObject("Counter");
if I substitute this.exportDataObject("c"); in the last line, I get a
file that has the original number in it. So I know that I am
importing/exporting it right, but I dont seem to be getting the actual
value out since it always exports the number 12 for Counter. Can
anyone tell me how to get the value out of the DataObject and translate
it into an integer?
Technical Details
Message-ID:
<1108659755.108216.34830@l41g2000cwc.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 109719,489c7d5a9ae86a6a,start X-Google-Attributes: gid109719,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mail From: gtrfrk213@gmail.com Newsgroups: adobe.scripting Subject: Acrobat JavaScript DataObjects Date: 17 Feb 2005 09:02:35 -0800 Organization: http://groups.google.com Lines: 26 Message-ID: <1108659755.108216.34830@l41g2000cwc.googlegroups.com> NNTP-Posting-Host: 137.28.21.136 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1108659759 30022 127.0.0.1 (17 Feb 2005 17:02:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Feb 2005 17:02:39 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=137.28.21.136; posting-account=tK8nlg0AAACK2DhacoZaYvJWJ4q-fK9W