Acrobat Sequ

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

ftp://ftp.adobe.com/pub/adobe/devnet/acrobat/downloads/batchseq.zip

ブラウザでダウンロードする場合は
https://download.adobe.com/pub/adobe/devnet/acrobat/downloads/batchseq.zip

全パターンJSを掲載しています
https://quicktimer.cocolog-nifty.com/icefloe/cat76054225/index.html

手順
1:アクロバット起動(全文書クローズ)
2:ツール>>アクションウィザード
3:新規アクション
4:左側下、その他ツール
5:Javascriptを実行を選択
6:ダイアログ中央の+→をクリック
7:ユーザーに確認のチェックを外す
8:設定を指示をクリック
9:Javascriptエディタに下記のソースをコピペ→OK
10:保存ーー>アクション名は、お好みで

内容は
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

Populate and Save.sequ.js

サンプルコード

サンプルソース(参考)
行番号ソース
001try {
002  var counter = 0;
003  if (!getConnected()) throw "Could not connect!";
004  do {
005    //      if (counter > 2) throw "Bailing out!"
006    var row = getNextRow();
007    if (row == null) throw "No more rows. Total processed: " + counter;
008    counter++
009    populateForm(row);
010    saveToFolder();
011  } while (true)
012}
013catch (e) {
014  console.println("Batch aborted: " + e);
015  event.rc = false;   // abort batch
016}
017console.println("End of Job Reached!");
018this.closeDoc(false);
019Connect.close();
AppleScriptで生成しました


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 2024 Acrobat AddOn Acrobat Annotation Acrobat AppleScript Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat GentechAI Acrobat JS Acrobat JS Word Search Acrobat Maintenance Acrobat Manifest Acrobat Menu Acrobat Merge Acrobat Open Acrobat PDFPage Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat Print Acrobat Python Acrobat Reader Acrobat Reader Localized Acrobat Reference Acrobat Registered Products Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat URL List Mac Acrobat URL List Windows Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin ConfigCode Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin NetWork Admin Permission Admin Pkg Admin Power Management Admin Printer Admin Printer Basic Admin Printer Custompapers Admin SetUp Admin SMB Admin softwareupdate Admin Support Admin System Information Admin TCC Admin Tools Admin Umask Admin Users Admin Volumes Admin XProtect Adobe Adobe AUSST Adobe Bridge Adobe Documents Adobe FDKO Adobe Fonts Adobe Reference Adobe RemoteUpdateManager Adobe Sap Code AppKit Apple AppleScript AppleScript Duplicate AppleScript entire contents AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Video Applications AppStore Archive Archive Keka Attributes Automator BackUp Barcode Barcode Decode Barcode QR Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome Chromedriver CIImage CityCode CloudStorage Color Color NSColor Color NSColorList com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Desktop Position Device Diff Disk do shell script Dock Dock Launchpad DropBox Droplet eMail Encode % Encode Decode Encode HTML Entity Encode UTF8 Error EXIFData exiftool ffmpeg File File Name Finder Finder Window Firefox Folder FolderAction Font List FontCollections Fonts Fonts Asset_Font Fonts ATS Fonts Emoji Fonts Maintenance Fonts Morisawa Fonts Python Fonts Variable Foxit GIF github Guide HTML Icon Icon Assets.car Illustrator Image Events ImageOptim Input Dictionary iPhone iWork Javascript Jedit Ω Json Label Language Link locationd lsappinfo m3u8 Mail Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Microsoft Fonts Microsoft Office Microsoft Office Link Microsoft OneDrive Microsoft Teams Mouse Music Node Notes NSArray NSArray Sort NSAttributedString NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSGraphicsContext Crop NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMetadataItem NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSet NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSUbiquitous NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth PDF PDF Image2PDF PDF MakePDF PDF nUP PDF Pymupdf PDF Pypdf PDFContext PDFDisplayBox PDFImageRep PDFKit PDFKit Annotation PDFKit AnnotationWidget PDFKit DocumentPermissions PDFKit OCR PDFKit Outline PDFKit Start PDFPage PDFPage Rotation PDFView perl Photoshop PlistBuddy pluginkit plutil postalcode PostScript PowerShell prefPane Preview Python Python eyed3 Python pip QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver Script Editor Script Menu SF Symbols character id SF Symbols Entity Shortcuts Shortcuts Events sips Skype Slack Sound Spotlight sqlite StandardAdditions StationSearch Subtitles LRC Subtitles SRT Subtitles VTT Swift swiftDialog System Events System Settings 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 Weather webarchive webp Wifi Windows XML XML EPUB XML HTML XML LSSharedFileList XML LSSharedFileList sfl2 XML LSSharedFileList sfl3 XML objectsForXQuery XML OPML XML Plist XML Plist System Events XML RSS XML savedSearch XML SVG XML TTML XML webloc XML xmllint XML XMP YouTube Zero Padding zoom