Skip to content

Instantly share code, notes, and snippets.

@cer
Last active January 12, 2021 03:41
Show Gist options
  • Save cer/ce7e296af39f6966530d77bedd4e14e1 to your computer and use it in GitHub Desktop.
Save cer/ce7e296af39f6966530d77bedd4e14e1 to your computer and use it in GitHub Desktop.
Bash/Applescript to export Omnigraffle file
#! /bin/bash
# FORMAT is PNG, SVG, ...
FORMAT=${1?}
INPUT="$(pwd)/${2?}"
OUTPUT="$(pwd)/${3?}"
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
cat <<END > $tmpfile
on convertGraffleFile(format, graffleFile, outputFile)
tell application "OmniGraffle"
close every document
open graffleFile
tell front document to export as format to POSIX file outputFile scope all graphics
close front document
end tell
end convertGraffleFile
on run argv
convertGraffleFile(item 1 of argv, item 2 of argv, item 3 of argv)
end run
END
osascript $tmpfile $FORMAT "${INPUT}" "${OUTPUT}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment