2013-06-27T15:26:56+09:00

OmniGraffle で開いているファイルを PDF として書き出す AppleScript

OmniGraffle で開いている最前面のファイルを PDF ファイルとして書き出す AppleScript です。PDF ファイルは OmniGraffle のファイルがあるフォルダに拡張子を "pdf" に変えた名前で保存されます。

実行には、

が必要です。

property PathInfo : module
property loader : boot (module loader) for me

on run
try
main()
on error msg number errno
if errno is not -128 then
activate
display alert msg message "Error Number : " & errno
end if
end try
end run

on main()
tell application id "com.omnigroup.OmniGrafflePro"
tell document 1
set documentPath to path
end tell
end tell

tell PathInfo's make_with(POSIX file documentPath)
set new_pdf_path to its change_path_extension("pdf")'s as_furl()
end tell

tell application id "com.omnigroup.OmniGrafflePro"
save the first document in new_pdf_path
activate process
display alert "Success to Export PDF file." message (new_pdf_path as text)
end tell
end main