Created
May 10, 2012 15:09
-
-
Save archgrove/2653761 to your computer and use it in GitHub Desktop.
Omnigraffle "Export all Canvases for LaTeX"
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
# Replace "search" with "replacement" in "input" (all text) | |
on replace_string(input, search, replacement) | |
set oldDelim to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to search | |
set textItems to every text item of input | |
set AppleScript's text item delimiters to replacement | |
set res to textItems as string | |
set AppleScript's text item delimiters to oldDelim | |
return res | |
end replace_string | |
tell application "OmniGraffle Professional 5" | |
set outputPath to (choose folder) as text | |
# Save the original canvas for restoration | |
set originalCanvas to canvas of front window | |
# Confgure the output type to all graphics | |
# Which will be interpreted as "current canvas" in PDF and EPS files | |
set area type of current export settings to all graphics | |
repeat with cvs in canvases of front document | |
# Deduce a filename based on the canvas name | |
set currentName to name of cvs as text | |
set cleanName to replace_string(currentName, " ", "_") of me | |
set canvas of front window to cvs | |
# Save as both EPS and PDF | |
set outputFile to outputPath & cleanName & ".eps" | |
save front document in outputFile | |
set outputFile to outputPath & cleanName & ".pdf" | |
save front document in outputFile | |
end repeat | |
set canvas of front window to originalCanvas | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment