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;
}


|

より以前の記事一覧

その他のカテゴリー

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