View Single Post
I have a simple script that exports the current canvas to a PDF file in the same directory as the .graffle file. It is very useful for putting figures in svn for those that don't have omnigraffle.

The problem is when moving from omnigraffle 5 pro to OG 6pro the script doesn't work. If I export the file by hand using the menu systems, then the script works. Even if I remove the pdf file!

Did some sort of set up command change in the dictionary? What can I do to get this script to work in OG 6 pro?

Here is the script

tell application "OmniGraffle"
	set thedocument to front document
	#set thePath to POSIX path of the folder of thedocument
	set thePath to the path of the thedocument
	set ASTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "/"
	set newName to (text items 1 through -2 of thePath) as text
	set AppleScript's text item delimiters to ASTID
	# 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
	set currentName to name of originalCanvas as text
	# this assumes a good canvance name for the file
	#set cleanName to replace_string(currentName, " ", "_") of me
	set cleanName to currentName
	# Save as PDF
	set outputFile to newName & "/" & cleanName & ".pdf"
	#display dialog outputFile
	save front document in outputFile
end tell