Last active
January 12, 2021 03:41
-
-
Save cer/ce7e296af39f6966530d77bedd4e14e1 to your computer and use it in GitHub Desktop.
Bash/Applescript to export Omnigraffle file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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