Acrobat Open

[Acrobat]メタデータ文書情報を全て削除(ドロップレット)


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003# com.cocolog-nifty.quicktimer.icefloe
004#前提条件
005# AcrobatでJavascripが有効に設定されている事
006# 別名で保存からアプリケーションでドロップレットになります
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012
013property refMe : a reference to current application
014###################
015#設定項目 対象のUTI
016property strUTI : ("com.adobe.pdf") as text
017
018###################
019#Wクリックで実行
020on run
021  ###ダイアログを前面に出す
022  tell current application
023    set strName to name as text
024  end tell
025  if strName is "osascript" then
026    tell application "Finder" to activate
027  else
028    tell current application to activate
029  end if
030  #ダイアログ
031  set appFileManager to refMe's NSFileManager's defaultManager()
032  set ocidUserDesktopPathArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
033  set ocidUserDesktopPath to ocidUserDesktopPathArray's objectAtIndex:0
034  set listChooseFileUTI to {strUTI} as list
035  set strMesText to ("PDFファイルを選んでください") as text
036  set strPromptText to ("PDFファイルを選んでください") as text
037  set listChooseAliasFilePath to (choose file strMesText with prompt strPromptText default location (ocidUserDesktopPath as alias) of type listChooseFileUTI with invisibles and multiple selections allowed without showing package contents) as list
038  #サブルーチンに渡す
039  set boolDone to doAction(listChooseAliasFilePath)
040  #戻り値がエラーだったか?
041  if boolDone is false then
042    display alert "エラーが発生しました" message "エラーが発生しました"
043    return
044  end if
045  return "処理終了RUN"
046end run
047
048###################
049#ドロップ
050on open listDropAliasFilePath
051  #サブルーチンに渡すリスト
052  set listAliasFilePath to {} as list
053  #ドロップされたアイテムの数だけ繰り返す
054  repeat with itemDropAliasFilePath in listDropAliasFilePath
055    #エイリアス
056    set aliasItemFilePath to itemDropAliasFilePath as alias
057    tell application "Finder"
058      #Finder情報を取得して
059      set recordInfoFor to info for aliasItemFilePath
060    end tell
061    #UTIを取得
062    set strItemUIT to (type identifier of recordInfoFor) as text
063    #UTIが対象ファイルならリストに追加
064    if strItemUIT is strUTI then
065      copy aliasItemFilePath to end of listAliasFilePath
066    end if
067  end repeat
068  set numCntAliasList to (count of listAliasFilePath) as integer
069  if numCntAliasList > 0 then
070    #サブルーチンに渡す
071    set boolDone to doAction(listAliasFilePath)
072  else
073    display alert "エラーが発生しました対象のファイルではありません"
074    return "エラー終了open"
075  end if
076  #戻り値がエラーだったか?
077  if boolDone is false then
078    display alert "エラーが発生しました" message "エラーが発生しました"
079    return "エラー終了open"
080  end if
081  return "処理終了open"
082  
083end open
084
085###################
086#実行されるのはこれ
087to doAction(argListAliasFilePath)
088  #ファイルエイリアスリストを順番の処理
089  repeat with itemAliasFilePath in argListAliasFilePath
090    set aliasFilePath to itemAliasFilePath as alias
091    try
092      #ここに処理内容
093      tell application "Adobe Acrobat"
094        open aliasFilePath
095        delay 1
096        tell active doc
097          do script ("this.info.Author = (\"\");")
098          do script ("this.info.Title = (\"\");")
099          do script ("this.info.Author = (\"\");")
100          ##  do script ("this.info.Authors = (\"\");") Acrobat9専用
101          do script ("this.info.Subject = (\"\");")
102          do script ("this.info.Keywords = (\"\");")
103          do script ("this.info.Creator = (\"\");")
104          do script ("this.info.Producer = (\"\");")
105          do script ("this.info.CreationDate = (\"\");")
106          do script ("this.info.ModDate = (\"\");")
107          do script ("this.info.Trapped = (\"\");")
108          close saving yes
109        end tell
110      end tell
111    on error
112      #エラーをログにする
113      refMe's NSLog("■■■: サブルーチンでエラーになりました")
114      return false
115    end try
116  end repeat
117  #全部エラーなく終わったらtrueを戻す
118  return true
119end doAction
AppleScriptで生成しました

|

[Acrobat]Parameters for Opening PDF Files(日本語版)

ダウンロード - pdf_open_parameters_ja.pdf



|

[Acrobat]処理方法の違いによる処理の完了までの時間

AppleScript

set aliasFilePath to (POSIX file "/private/tmp/16p.pdf") as alias
set listFilePath to {aliasFilePath} as list
do shell script "date"
tell application id "com.adobe.Reader"
  activate
  tell front window
    open aliasFilePath without invisible
  end tell
end tell
do shell script "date"

結果 約5秒
tell current application
  do shell script "date"
    --> "Fri Apr  7 21:56:23 JST 2023"
end tell
tell application "Adobe Acrobat Reader"
  activate
  open alias "Macintosh HD:private:tmp:16p.pdf" without invisible
    --> missing value
end tell
tell current application
  do shell script "date"
    --> "Fri Apr  7 21:56:28 JST 2023"
end tell



Javascript
do shell script "date"
tell application id "com.adobe.Reader"
  activate
  do script "app.openDoc(\"/private/tmp/16p.pdf\");"
end tell
do shell script "date"

結果 1秒以内
tell current application
  do shell script "date"
    --> "Fri Apr  7 21:58:16 JST 2023"
end tell
tell application "Adobe Acrobat Reader"
  activate
  do script "app.openDoc(\"/private/tmp/16p.pdf\");"
    --> "[object Doc]"
end tell
tell current application
  do shell script "date"
    --> "Fri Apr  7 21:58:16 JST 2023"
end tell

|

[Acrobat]書類オープン時のオプション指定方法

【スクリプトエディタで開く】

#/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# com.adobe.Acrobat.Pro
# com.adobe.Reader
#
#   com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

set listUTI to {"com.adobe.pdf"}
set strPromptText to "ファイルを選んでください"
set strPromptMes to "ファイルを選んでください"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
####ダイアログを出す
set aliasFilePath to (choose file strPromptMes with prompt strPromptText default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
log class of aliasFilePath


#####################################
##### ファイルオープン オプション指定  mode
#####################################
(*
pagemode=bookmarks
pagemode=thumbs
*)
tell application id "com.adobe.Reader"
  launch
  activate
  open aliasFilePath options "zoom=50&pagemode=bookmarks"
end tell



#####################################
##### ファイルオープン オプション指定 zoom
#####################################

tell application id "com.adobe.Reader"
  launch
  activate
  open aliasFilePath options "zoom=30"
end tell



#####################################
##### ファイルオープン オプション指定 page
#####################################

tell application id "com.adobe.Reader"
  launch
  activate
  open aliasFilePath options "page=4"
end tell

#####################################
##### ファイルオープン オプション指定  同時指定
#####################################

tell application id "com.adobe.Reader"
  launch
  activate
  open aliasFilePath options "page=4&zoom=30"
end tell

#####################################
##### ファイルオープン オプション指定  Fit
#####################################
(*
view=Fit
view=FitH
view=FitH,top
view=FitV
view=FitV,left
view=FitB
view=FitBH
view=FitBH,top
view=FitBV
view=FitBV,left
*)

tell application id "com.adobe.Reader"
  launch
  activate
  open aliasFilePath options "page=1&view=FitBH,top"
end tell

|

[Acrobat]Open options

ダウンロード - pdf_open_parameters_acro8.pdf




|

その他のカテゴリー

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