[exiftool]画像のダンプ(少し修正)
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
#####設定項目
####exiftoolへのパス
set strExifPath to "$HOME/bin/exiftool/exiftool"
########################################
#######前準備
##このファイルへのパスとコンテナ
tell application "Finder"
set aliasPathToMe to (path to me) as alias
set aliasPathToMeDir to (container of aliasPathToMe) as alias
end tell
set strPathToMePath to (POSIX path of aliasPathToMe) as text
set strPathToMeDirPath to (POSIX path of aliasPathToMeDir) as text
########################################
#######ファイル選択
---プロンプトの文言改行が使えます\nを入れます
set theWithPrompt to "ファイルを選択してください"
---ファイル選択ダイアログのデフォルトのディレクトリ
set aliasDefaultLocation to path to desktop folder from user domain
set theFileTypeList to {"public.image"}
---ダイアログを出して選択されたファイルは「open」に渡す
set aliasFilePath to (choose file default location aliasDefaultLocation ¬
with prompt theWithPrompt ¬
of type theFileTypeList ¬
invisibles false ¬
with showing package contents without multiple selections allowed)
####入力ファイル関連
set strFilePath to POSIX path of aliasFilePath as text
###NSストリングに
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURLに
set ocidFilePathURL to refMe's NSURL's fileURLWithPath:ocidFilePath
##ファイル名取得
set strFileName to (ocidFilePathURL's lastPathComponent) as text
########################################
######出力ファイル
##ファイル名
set strFileName to (strFileName & ".html") as text
set aliasSaveFilePath to choose file name with prompt "保存するHTMLのファイル名を付けてください" default name strFileName default location (aliasDefaultLocation)
###パス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
###NSストリングに
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
###NSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
##拡張子
set strFileExtension to (ocidSaveFilePathURL's pathExtension) as text
log strFileExtension
###拡張子つけ忘れ対策
if strFileExtension is not "html" then
set strSaveFilePath to (strSaveFilePath & ".html") as text
end if
########################################
######データ処理
###データ取得
set theCommandText to ("\"" & strExifPath & "\" -htmlDump \"" & strFilePath & "\" > \"" & strSaveFilePath & "\"") as text
do shell script theCommandText
tell application "Finder"
open file aliasSaveFilePath
end tell
return
| 固定リンク
「EXIFData」カテゴリの記事
- [exiftool]メタデータをHTML出力する(ダイアログSystemUIServer版)(2025.02.19)
- [Automator]exif2html exifデータをHTML表示させるクイックアクション(2024.08.26)
- [bash]exiftoolインストール(シングルファイル形式のPKG対応)(2024.07.29)
- [applescript]exiftoolインストール(シングルファイル形式のPKG対応)(2024.07.29)
- [PDF]PDFのメタデータの取り出し方法いろいろ(デモ)(2024.07.02)
「exiftool」カテゴリの記事
- [bash] JQによるJSONの処理(2025.04.03)
- [exiftool]メタデータをHTML出力する(ダイアログSystemUIServer版)(2025.02.19)
- [Automator]exif2html exifデータをHTML表示させるクイックアクション(2024.08.26)
- [bash]exiftoolインストール(シングルファイル形式のPKG対応)(2024.07.29)
- [applescript]exiftoolインストール(シングルファイル形式のPKG対応)(2024.07.29)