Acrobat Sequ

[sequ]旧バージョンのアクション

ftp://ftp.adobe.com/pub/adobe/devnet/acrobat/downloads/batchseq.zip
内容は
Change Security to None.sequ
Comments to tab-delimited file.sequ
Copy Bookmarks from Array.sequ
Count Bookmarks.sequ
Count PDF files.sequ
Cross Doc Comment Summary.sequ
Extract Pages to Folder.sequ
Gather Bookmarks to Array.sequ
Gather Bookmarks to Doc.sequ
Gather DigSig Info.sequ
Import Named Icons.sequ
Insert Barcode.sequ
Insert Bookmarked Pages .sequ
Insert Navigation Icons.sequ
Insert Stamp.sequ
List all Bookmarks .sequ
Populate and Save.sequ
Signature Sign All.sequ
Spell Check a Document.sequ



ダウンロード - batchseq.zip

|

Insert Barcode.sequ


/*
** This script inserts a text field on the first page of each 
** the selected documents. The textFont is set to a barcode font;
** hence, a barcode will appear.  Barcode font required. 
*/
// getPageBox, the default is "Crop"
var aPage = this.getPageBox();

// put barcode in upper right-hand corner of page 0
// text field is 144 pts wide and 20 high
aPage[3] = aPage[1] - 20;
aPage[0] = aPage[2] - 144

var f = this.addField("myText", "text", 0, aPage);
f.delay = true;
f.readonly = true;
f.alignment = "right";
f.textFont = "Code39Two";   // change as desired
f.fillColor = color.transparent;
f.value = "ID-123-4567";
f.delay = false;

|

Extract Pages to Folder.sequ

Mac


var re = /.*\/|\.pdf$/ig;

// filename is the base name of the file Acrobat is working on

var filename = this.path.replace(re, "");

try {
  for (var i = 0; i < this.numPages; i++)
    this.extractPages
      ({
        nStart: i,
        cPath: "/Users/Shared/" + filename + "_" + i + ".pdf"
      });
} catch (e) { console.println("Aborted: " + e) }



Win

var re = /.*\/|\.pdf$/ig;

// filename is the base name of the file Acrobat is working on

var filename = this.path.replace(re,"");

try {
            for ( var i = 0; i < this.numPages; i++) 
            this.extractPages
            ({
                   nStart: i,
                   cPath: "/C/temp/myDocs/"+filename+"_" + i +".pdf"
            });         
} catch (e) { console.println("Aborted: " + e) }



|

Insert Stamp.sequ


var aCrop = this.getPageBox()

var semiWidth = aCrop[2] / 2;
var semiHeight = aCrop[1] / 2;

// center of the crop box.
var x = semiWidth;
var y = semiHeight;

// Make the width of the stamp roughly, .67% of cropped page width, and
// make height of stamp 25% of the stamp's width
semiWidth = 0.67 * semiWidth;    // make width .67 of width of page
semiHeight = 0.25 * semiWidth;   // make height .25  of semiWidth

var Rect = new Array(x - semiWidth, y - semiHeight, x + semiWidth, y + semiHeight);

var m = (new Matrix2D).fromRotated(this, 0)
Rect = m.transform(Rect)

var annot = this.addAnnot
  ({
    page: 0,
    type: "Stamp",
    name: "myStamp",
    rect: Rect,
    contents: "This document has been approved.",
    AP: "Approved"
  });


|

List all Bookmarks .sequ


function PrintBookmarks(bm, nLevel)
{
    if (nLevel != 0) { // don't print the root 
        bmReport.absIndent=bmTab*(nLevel-1);
        bmReport.writeText(util.printf("%s",bm.name));
    }        
    if (bm.children != null)
          for (var i = 0; i < bm.children.length; i++) 
            PrintBookmarks(bm.children[i], nLevel + 1);                           
}
bmTab = 20;
bmReport = new Report();
bmReport.size = 2;
bmReport.writeText(this.title);
bmReport.writeText(" ");
bmReport.size = 1.5;
bmReport.writeText("Listing of Bookmarks");
bmReport.writeText(" ");
bmReport.size = 1;
PrintBookmarks(this.bookmarkRoot, 0);
global.bmRep = bmReport;  // make global
if ( app.viewerVersion < 7 ) {
    global.wrtDoc = app.setInterval(
        'try {'
        +'       reportDoc = global.bmRep.open("Listing of Bookmarks");'
        +'       console.println("Executed Report.open");'
        +'       app.clearInterval(global.wrtDoc);'
        +'       delete global.wrtDoc;'
        +'       console.println("Executed App.clearInterval");'
        +'       reportDoc.info.title = "Bookmark Listings";'
        +'       reportDoc.info.Author = "A. C. Robat";'
        +'} catch (e) {console.println("Waiting...: " + e);}'
        , 100);
} else {
    reportDoc = global.bmRep.open("Listing of Bookmarks");
    console.println("Executed Report.open");
    reportDoc.info.title = "Bookmark Listings";
    reportDoc.info.Author = "A. C. Robat";
}



|

Populate and Save.sequ


try {
  var counter = 0;
  if (!getConnected()) throw "Could not connect!";
  do {
    //      if (counter > 2) throw "Bailing out!"
    var row = getNextRow();
    if (row == null) throw "No more rows. Total processed: " + counter;
    counter++
    populateForm(row);
    saveToFolder();
  } while (true)
}
catch (e) {
  console.println("Batch aborted: " + e);
  event.rc = false;   // abort batch
}
console.println("End of Job Reached!");
this.closeDoc(false);
Connect.close();

|

Spell Check a Document.sequ

var numChkWord, numWords, numPageCnt, numWordCnt;
for (var numPageCnt = 0; numPageCnt < this.numPages; numPageCnt++) {
  numWords = this.getPageNumWords(numPageCnt);
  for (numWordCnt = 0; numWordCnt < numWords; numWordCnt++) {
    numChkWord = spell.checkWord(this.getPageNthWord(numPageCnt, numWordCnt))
    if (numChkWord != null) {
      annot = this.addAnnot
        ({
          page: numPageCnt,
          name: "スペルチェック",
          subject: "スペルチェック",
          type: "Highlight",
          //  これでもOK  Squiggly波線 Underline下線
          //  type: "Squiggly",
          //  type: "Underline",
          strokeColor:[ "CMYK", 0,1,0,0 ],
          //  固定色指定する場合は↓
          // strokeColor: color.red,
          //  RGB色指定する場合は
          //  strokeColor:[ "RGB", 1,0,0 ],
          // 色を変更したい場合はここで変更
          // Black  color.black [ "G", 0 ]
          // White  color.white [ "G", 1 ]
          // Red  color.red [ "RGB", 1,0,0 ]
          // Green  color.green [ "RGB", 0,1,0 ]
          // Blue color.blue  [ "RGB", 0, 0, 1 ]
          // Cyan color.cyan  [ "CMYK", 1,0,0,0 ]
          // Magenta  color.magenta [ "CMYK", 0,1,0,0 ]
          // Yellow color.yellow  [ "CMYK", 0,0,1,0 ]
          // Dark Gray  color.dkGray  [ "G", 0.25 ]
          // Gray color.gray  [ "G", 0.5 ]
          // Light Gray color.ltGray  [ "G", 0.75 ]
          opacity: 1,
          // 半透明にする事もできます 0.0 から 1までの間で設定
          quads: this.getPageNthWordQuads(numPageCnt, numWordCnt),
          author: "Acrrobatのスペルチェック",
          //ここは自由に変更できます
          //作成者を自分にしたい場合は↓のようにすればOk
          //  author: identity.name,
          contents: "スペルの確認をしてください" + numChkWord.toString() 
        });
    }
  }
}



オリジナル

var ckWord, numWords, i, j;
for (var i = 0; i < this.numPages; i++) {
  numWords = this.getPageNumWords(i);
  for (j = 0; j < numWords; j++) {
    ckWord = spell.checkWord(this.getPageNthWord(i, j))
    if (ckWord != null) {
      annot = this.addAnnot
        ({
          page: i,
          type: "Squiggly",
          quads: this.getPageNthWordQuads(i, j),
          author: "A. C. Acrobat",
          contents: ckWord.toString()
        });
    }
  }
}

var numChkWord, numWords, numPageCnt, numWordCnt;
for (var numPageCnt = 0; numPageCnt < this.numPages; numPageCnt++) {
  numWords = this.getPageNumWords(numPageCnt);
  for (numWordCnt = 0; numWordCnt < numWords; numWordCnt++) {
    numChkWord = spell.checkWord(this.getPageNthWord(numPageCnt, numWordCnt))
    if (numChkWord != null) {
      annot = this.addAnnot
        ({
          page: numPageCnt,
          name: "スペルチェック",
          subject: "スペルチェック",
          type: "Highlight",
          //  これでもOK  Squiggly波線 Underline下線
          //  type: "Squiggly",
          //  type: "Underline",
          strokeColor:[ "CMYK", 0,1,0,0 ],
          //  固定色指定する場合は↓
          // strokeColor: color.red,
          //  RGB色指定する場合は
          //  strokeColor:[ "RGB", 1,0,0 ],
          // 色を変更したい場合はここで変更
          // Black  color.black [ "G", 0 ]
          // White  color.white [ "G", 1 ]
          // Red  color.red [ "RGB", 1,0,0 ]
          // Green  color.green [ "RGB", 0,1,0 ]
          // Blue color.blue  [ "RGB", 0, 0, 1 ]
          // Cyan color.cyan  [ "CMYK", 1,0,0,0 ]
          // Magenta  color.magenta [ "CMYK", 0,1,0,0 ]
          // Yellow color.yellow  [ "CMYK", 0,0,1,0 ]
          // Dark Gray  color.dkGray  [ "G", 0.25 ]
          // Gray color.gray  [ "G", 0.5 ]
          // Light Gray color.ltGray  [ "G", 0.75 ]
          opacity: 1,
          // 半透明にする事もできます 0.0 から 1までの間で設定
          quads: this.getPageNthWordQuads(numPageCnt, numWordCnt),
          author: "Acrrobatのスペルチェック",
          //ここは自由に変更できます
          //作成者を自分にしたい場合は↓のようにすればOk
          //  author: identity.name,
          contents: "スペルの確認後、この注釈を削除してください" + numChkWord.toString() 
        });
    }
  }
}

|

Count PDF files.sequ

if ( typeof global.FileCnt == "undefined") global.FileCnt = 0;
global.FileCnt++;
console.println("FileCnt = "+global.FileCnt);

|

Count Bookmarks.sequ


function CountBookmarks(bm, nLevel)
    if (nLevel != 0) counter++
    if (bm.children != null)
        for (var i = 0; i < bm.children.length; i++) 
            CountBookmarks(bm.children[i], nLevel + 1);   
var counter = 0;
CountBookmarks(this.bookmarkRoot, 0);
console.show();
console.println("\nFile: "+this.path);
console.println("The number of bookmarks is " + counter);

|

Copy Bookmarks from Array.sequ


if ( typeof global.counter == "undefined")  {  
      console.println("Begin Job...");
      global.counter = 0;
      if ( typeof global.FileCnt == "undefined" )     // if a separate file count has not been run
           global.FileCnt = global.bmFileCnt;         // then use the file count from Gather bookmarks from an Array
}
try 
{
    global.counter++
    console.println("Processing file \#"+global.counter);

    // Now, insert a bookmark at end of bookmark tree
    for (var i = 0; i < global.bmArray.length; i++) {
        var nIndex = (this.bookmarkRoot.children == null ) ? 0 : this.bookmarkRoot.children.length;       
        this.bookmarkRoot.createChild(global.bmArray[i][0],
        'if (this.external) \r\t'
        +'this.getURL("' + global.bmArray[i][1] + '.pdf");\r'
        +'else {\r\t'
        +'var that = app.openDoc("' + global.bmArray[i][1] + '.pdf", this);\r\t'
        +'if ( this != that ) this.closeDoc();\r'
        +'}',
        nIndex);
    }
catch (e) 
{
    console.println("Aborting Batch: " + e);
    console.println("Current File: " + this.path);
    event.rc = false;
    delete global.counter;
}

// End of Job
if (global.counter == global.FileCnt) {
    console.println("End of Job...");
    delete global.indexCnt;
    delete global.bmFileCnt;
    delete global.bmArray;
    delete global.counter;
    delete global.FileCnt;
}


|

より以前の記事一覧

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom