Folder Level Script Required to add Toolbar Item
Hello Guys i tried my level best to add my code to add in tool bar. I cant succeed. I am beginner so i unable to grasp some complicated technical terms. Anyone please add the folder scripting code to run my existing code. Below code is i am using in Acrobat 11 but now i want to do it in acrobat 9 tool bar. Please help.
// pages on which that string is found to a new file.
var pageArray = [];
var stringToSearchFor = "SHEET";
for (var p = 0; p < this.numPages; p++) {
// iterate over all words
for (var n = 0; n < this.getPageNumWords(p); n++) {
if (this.getPageNthWord(p, n) == stringToSearchFor) {
pageArray.push(p);
break;
}
}
}
if (pageArray.length > 0) {
// extract all pages that contain the string into a new document
var d = app.newDoc();
// this will add a blank page - we need to remove that once we are done
for (var n = 0; n < pageArray.length; n++) {
d.insertPages( {
nPage: d.numPages-1,
cPath: this.path,
nStart: pageArray
, nEnd: pageArray
, } );
}
// remove the first page
d.deletePages(0);
var annots=d.getAnnots();
for (i in annots) annots.destroy();
// Save the new document:
var myDocPath = this.path;
var aPathComps = myDocPath.split("/");
var myFilename = aPathComps[aPathComps.length-2]; // Last element
d.saveAs("/c/QC Tool/Art Pages/"+ myFilename+".xlsx", "com.adobe.acrobat.xlsx");
d.closeDoc(true);
}
