Top / AppleScript
●クリップボードのイメージを保存
以下のスクリプトの前に、Mac OS Xだと、do shell script "screencapture -c"などとすれば (-cはクリップボードへというオプション)、クリップボードへモニタ画面を取り込むことも簡単に自動化できるようだし、別の何かと組み合わせると便利かも。
tell application "GraphicConverter Classic"
activate
set thePict to new image from clipboard -- クリップボードのイメージを取り込む
set thePath to ((path to desktop) as string) & (date string of (current date)) & ".png"
-- デスクトップに日付を名前に
tell thePict
change colors to bit depth 8 with grayscale without dither -- 256色のグレースケールに
save in thePath as PNG with wwwready -- PNG形式で、アイコンなどリソースなしで保存
-- 同名のファイルがデスクトップにあった場合、上書き保存される
end tell
end tell
tell application "GraphicConverter Classic" to close front window
-- 上のtell thePictとend tellの間にcloseと書いてもよさそうだけど、動作しないので分けてみた
-- delay 3などとしてタイミングを調整すればいいのかもしれない
●画像添えHTML文書作成支援
画像の入ったHTML文書にするにはimg要素 (<img src="hoge.jpg">みたいな) として表現する必要がありますよね。このスクリプトは今GraphicConverterで開いている画像のimg要素をクリップボードに書き出すものです。画像の幅や高さの属性に加えて、align属性で右寄せにしてみましたが、好みに合わせて書き換えるといいと思います。
tell application "GraphicConverter Classic"
set thePict to front window
tell thePict
set theName to name
set {theWidth, theHeight} to image dimension
end tell
set htmlStr to "<img src=\"./images/" & theName & "\"" & ¬
" alt=\"myFig\" align=\"right\"" & ¬
" width=\"" & (theWidth as string) & "\"" & ¬
" height=\"" & (theHeight as string) & "\">"
end tell
set the clipboard to htmlStr
Top / AppleScript