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

Putting comments (annotations) into one spreadsheet

erica1126
Registered: Feb 16 2009
Posts: 3

First of all- thank you to the posters of these threads:
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=15426 and http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=15423.
These were very helpful to me. I don't pretend to know how to write JavaScript or alter sequences so I am asking for some help tweaking the sequence a bit.

I need to change the Batch Sequence, Comments to Tab-Delimited File.sequ, to:
1. display the full path and filename; and
2. display the highlighted text as it does for sticky notes.

I would like to have the filename in its own column such as the reviewer, page, etc. The filename would repeat in the column each time for each comment/annotation. And where the filename current is placed on the spreadsheet, I would like the full pathname to display instead or even be in a column itself and repeat throughout the spreadsheet.

I saw the Batch Sequence for displaying the highlighted text, but I don't know exactly what to include/leave out so that the text is in the same column as the text from the sticky notes.

Any help is much appreciated. Thanks!

My Product Information:
Acrobat Pro 8.0, Windows
daka630
Expert
Registered: Mar 1 2007
Posts: 1420
Bon dia erica126,
-- ++ -------------------- ++ --

Quote:
1. display the full path and filename
The Batch Sequence [b]Comments to Tab-Delimited File.sequ[/b] delivers the filename.
The delimited file, once in a spreadsheet, provides the following column headers:
File Name | Name | Type | Page | Modification Date | Comment
--| File Name (name of the processed PDF file)
--| Name (the author's name as set in Acrobat's Preferences)
--| Type (of Annotation)
--| Page (note that the "true" first page number of any PDF is zero ("0"))
--| Modification Date (initially, creation date of the Annotation; later, the date the Annotation is modified)
--| Comment (contents of the Tool's "pop-up" OR for Sticky Notes the entered content)

n.b., The Batch Sequence outputs a PDF & attached to this PDF is the *.xls file containing the Tab-Delimited File.
Click on the paper clip (bottom left) to open the attachment panel. Open the file "mySummary.xls".
From Excel, "Save As" to a *.xls file (& give it a new file name). You may want to browse out of the default directory
(Temp) to some other location.

But, can the Batch Sequence's javascript be modified to provide the path (and filename)?
Yes. See the original and modified Batch Sequence javascript below.
So, the modified Batch Sequence would result in these column headers:
File Path | Name | Type | Page | Modification Date | Comment


Quote:
2. display the highlighted text as it does for sticky notes.
Edit --> Preferences --> Commenting "Copy selected text into Highlight, Cross-Out, and Underline comment pop-ups"
Performing the above assures that [i]any[/i] selected character string, while using one of the commenting tools identified above,
will be placed into the tool's associated pop-up. The tool's pop-up is analogous to the Sticky Note. However, a given
tool's popup *is not* a "Sticky Note".

Note that selecting "Copy encircled text into Drawing comment pop-ups"
performs a similar function.

When using [b]Comments to Tab-Delimited File.sequ[/b] the pop-up's content, for each discrete comment becomes
a specific data entry value in the delimited string associated with the specific comment (annotation).
As each delimited string is a unique record / row of data the string's content becomes a row in the spreadsheet.
Each "value" in the string has an associated source/name/key/parent ...whatever.
This is reflected in the column header entry.

n.b., Remember - the comment/markup tools are just different kinds of Annotations.
Each is a unique. So, while each can/does have like named attributes, these attributes are unique to the
annotation type.

Quote:
I saw the Batch Sequence for displaying the highlighted text, but I don't know exactly what to include/leave out so that the text is in the same column as the text from the sticky notes.
In light of what is described above, you'll not get the attribute of character strings in the popup for Highlight Annotation
placed with the attribute of character strings in the Sticky Note Annotation.
So,

Quote:
...the text is in the [i]same[/i] column as the text from the sticky notes.
is something I don't think you'll get out of this particular Batch Sequence.

Jack (the "sticky note") has brown eyes (text in the sticky note).
Jill (the "Highlight") has brown eyes (text in the pop-up).
The batch sequence cannot re-assign Jill's eyes to Jack.

Of course, once you have your spreadsheet content in place you can always edit that manually or programmatically to shake and bake it
as desired.


-- ++ ----- Original javascript found in the Batch Sequence ---------- ++ --

/* Comments to tab-delimited file */
/* Acrobat 7.0 Required -daka630 edit: use with Acrobat 7.0 Pro or newer
** Prior to running this script for the first time, be sure the global
** variable global.startBatch is undefined. If necessary, execute
** delete global.startBatch from the console.
*/

var re = /\"/g; // find all double quotes ("), used with annots.contents
if ( typeof global.startBatch == "undefined" ) {
global.startBatch = true;
global.myContainer = app.newDoc();
global.myContainer.createDataObject({
cName: "mySummary.xls",
cValue: "File Name\tName\tType\tPage\tModification Date\tComment"
});
var dataLine = "";
}
try {
this.syncAnnotScan();
dataLine += "\r\n"+this.documentFileName;
var annots=this.getAnnots({nSortBy: ANSB_Author});
if ( annots != null ) {
for (var i=0; i < annots.length; i++)
{
var cContent = annots[i].contents.replace(re, "\"\"");
dataLine += "\r\n\t"+ annots[i].author
+ "\t" + annots[i].type
+ "\t" + annots[i].page
+ "\t" + util.printd(2, annots[i].modDate)
+ "\t\""+ cContent+"\"";
}
var oFile = global.myContainer.getDataObjectContents("mySummary.xls");
cFile = util.stringFromStream(oFile, "utf-8");
cFile += dataLine;
dataLine = "";
oFile = util.streamFromString( cFile, "utf-8" );
global.myContainer.setDataObjectContents({ cName: "mySummary.xls", oStream: oFile });
} else console.println("The document " + this.documentFileName + " contains no annots.");
} catch(e) {
console.println("Error on line " + e.lineNumber + ": " + e);
delete typeof global.startBatch
event.rc = false; // abort batch
}

-- ++ ----- Modified javascript found in the Batch Sequence ---------- ++ --
/* Comments to tab-delimited file */
/* Acrobat 7.0 Required -daka630 edit: use with Acrobat 7.0 Pro or newer
** Prior to running this script for the first time, be sure the global
** variable global.startBatch is undefined. If necessary, execute
** delete global.startBatch from the console.
*/

var re = /\"/g; // find all double quotes ("), used with annots.contents
if ( typeof global.startBatch == "undefined" ) {
global.startBatch = true;
global.myContainer = app.newDoc();
global.myContainer.createDataObject({
cName: "mySummary.xls",
cValue: "File Path\tName\tType\tPage\tModification Date\tComment"
});
var dataLine = "";
}
try {
this.syncAnnotScan();
dataLine += "\r\n"+this.path;
var annots=this.getAnnots({nSortBy: ANSB_Author});
if ( annots != null ) {
for (var i=0; i < annots.length; i++)
{
var cContent = annots[i].contents.replace(re, "\"\"");
dataLine += "\r\n\t"+ annots[i].author
+ "\t" + annots[i].type
+ "\t" + annots[i].page
+ "\t" + util.printd(2, annots[i].modDate)
+ "\t\""+ cContent+"\"";
}
var oFile = global.myContainer.getDataObjectContents("mySummary.xls");
cFile = util.stringFromStream(oFile, "utf-8");
cFile += dataLine;
dataLine = "";
oFile = util.streamFromString( cFile, "utf-8" );
global.myContainer.setDataObjectContents({ cName: "mySummary.xls", oStream: oFile });
} else console.println("The document " + this.documentFileName + " contains no annots.");
} catch(e) {
console.println("Error on line " + e.lineNumber + ": " + e);
delete typeof global.startBatch
event.rc = false; // abort batch
}
-- ++ --------- Difference ------------ ++ --
Original line

Quote:
cValue: "File Name\tName\tType\tPage\tModification Date\tComment"
becomes

Quote:
cValue: "File Path\tName\tType\tPage\tModification Date\tComment"
in the Modified script

Original line

Quote:
dataLine += "\r\n"+this.documentFileName;
becomes

Quote:
dataLine += "\r\n"+this.path;
in the Modified script

I suppose one could change the line
} else console.println("The document " + this.documentFileName + " contains no annots.");

to
} else console.println("The document " + this.path + " contains no annots.");

but, I didn't bother.
-- ++ ----------------------------------------------------- ++ --
n.b., don't forget the ";delete global.startBatch" in the console.

Given that I'm not much more than a beginner novice with Acrobat javascript some of the more knowledgeable Community members
might weigh in with more experienced suggestions.
However all this might help get you closer to your goal .Well, gotta go - have a date with my wife to watch "Survivor" 8^)

Be well...

Be well...