UNIXのコマンド(CUI)をGUI的に利用するためのアップルスクリプトを作ってみた。
例えばdcrawでrawデータをTIFFに変換するなら、
$ ./dcraw -T <変換したいファイル>
とする訳だが、コレをファイルのドラッグドロップで処理したい。
on open objects
repeat with obj in objects
set tgPath to getPosixPath(obj)
set cmd to "/Applications/dcraw -T " & tgPath & ""
do shell script cmd
end repeat
end opento getPosixPath(theFile)
return quoted form of POSIX path of theFile
end getPosixPath
こういうスクリプトをスクリプトエディタで書いて、アプリケーション形式で保存する。
dcrawは/Applicationsフォルダに置いておく。
で、ファイルをこのスクリプトにドラッグ&ドロップすれば処理が出来る。
その他パラメータを明示的に指定する方法
例 dcrawのbrightnessを指定する
property bNess : "1.0"on run
set ans to display dialog "Enter the brightness (default=1.0):" default answer bNess
set bNess to text returned of ans
end runon open objects
repeat with obj in objects
set tgPath to getPosixPath(obj)
set cmd to "/Applications/dcraw -b " & bNess & " -T " & tgPath & ""
do shell script cmd
end repeat
end opento getPosixPath(theFile)
return quoted form of POSIX path of theFile
end getPosixPath
こんなふうにしておくとスクリプトをダブルクリックした際に
こういうダイアログがでてくるので数値を入力して、画像ファイルをドロップすると明るさをいじれます。
1.0(デフォルト)の場合
2.0にした場合
ちなみにこれらの写真は93年製のApple QuickTake100 (150にアップグレード済み)によるPICT形式の画像から変換。
http://www.apple.com/jp/support/datasheet/others/QT150.html
PICTといいながら汎用のフォーマットじゃなくてApple独自の圧縮加工がされていて、OS9以前の環境に専用の機能拡張を入れておかないと表示すら出来ない代物だったが、dcrawで「現像」可能だった。