Convert OmniGraffle Package Format to Flat Format

Hey all, I wanted to share a useful script if you have a bunch of OmniGraffle files that are saved as Automatic/Package format and want to convert them all to Flat. This makes them more Windows friendly especially if you are storing the files on OneDrive. Execute this script using Mac’s Script Editor. Select a folder that contains the OmniGraffle Documents or Stencils. This script will go through each document, open it, convert it, save it, close it. This script will also go into any subdirectories from the root folder you select. Special thanks to Christian Y. from the OmniGroup team for its initial creation.

# Original script created by Christian Y. (Support Human) in the OmniGroup
# for the VMware Design Team. - 2019
# Version 1.0

property errorList : "" -- This is needed so that the sub-routine can build a list of files should  there be any errors

on run
set errorList to "" -- Needed to reset the list from the last time the script was run 

tell application "Finder"
set sourceFolder to choose folder with prompt "Please select a folder containing OmniGraffle files:"
set foundItems to (items of sourceFolder) as alias list

my getFilesToProcess(foundItems)
end tell

if errorList is not "" then
display alert "An error occured trying to process the following files:" message errorList
return errorList
end if

end run

on getFilesToProcess(foundItems)
tell application "Finder"
set filesToProcess to {}

repeat with anItem in foundItems
set fileExt to name extension of anItem

if kind of anItem is "folder" then
set folderContents to (items of anItem) as alias list
my getFilesToProcess(folderContents)

else if fileExt is "graffle" or fileExt is "gstencil" or fileExt is "gtemplate" then
copy anItem to end of filesToProcess

end if

end repeat

my processFiles(filesToProcess)

end tell
end getFilesToProcess

on processFiles(graffleFiles)

repeat with aFile in graffleFiles

tell application "OmniGraffle"

open aFile
delay 0.6

tell application "System Events" to tell process "OmniGraffle"
set frontmost to true

delay 0.5

try -- Click OK if you get a prompt about missing fonts or similar messages
click button "OK" of sheet 1 of window 1
delay 0.5
end try

try -- Click "Edit in Place" documnet in the prompt that appears when opening stencil or template files outside of the sandbox
click button "Edit in Place" of sheet 1 of window 1
delay 0.5
end try

click menu item "Document" of menu "Inspectors" of menu bar item "Inspectors" of menu bar 1

try -- First attempt, which works if the left-hand sidebar is hidden

tell pop up button 1 of scroll area 2 of splitter group 1 of window 1
delay 0.5
click menu item "Save as flat file" of menu 1
end tell

on error -- Alternate attempt, which works if the left-hand sidebar is showing

tell pop up button 1 of scroll area 3 of splitter group 1 of window 1
delay 0.5
click menu item "Save as flat file" of menu 1
end tell

end try

end tell

tell front document
delay 0.5
end tell

on error
tell application "Finder"

set filename to name of aFile
set parentFolder to name of container of aFile

set errorList to errorList & "- " & parentFolder & "/" & filename & return

end tell
end try

end tell

end repeat

end processFiles

Design Posts

Hey everyone, going forward, I will be posting various tips and tricks on creating designs leveraging OmniGraffle and also Excel. I am the creator of the internal VMware Horizon Suite Sizing Estimator, and my nose is buried in excel sheets, daily. When it comes to the creation of designs, that is all I work in now is OmniGraffle. I figure it might help those who also do the same. 


Excel Tip:

To subtract 15%, add a negative sign in front of the percentage, and subtract the percentage from 1, using the formula =1-n%, in which n is the percentage. To subtract 15%, use =1-15% as the formula. Example:

Cell A1 Contains 100, Cell B1 Contains 15%

=A1-(A1*B1) = 85

Format your formula like this:

=A1-(1-B1) = 85



OmniGraffle Tip:

You might have multiple text boxes after a Visio Import, for example:






To merge these two text boxes into a single text box:

– Select all the text boxes you want to be grouped

– Two Options

    1) From the Menu select ‘Edit > Objects > Unite Shapes’

    2) Right-click on the selected group, select ‘Unite Shapes’

This will form a complete text box that you still can edit.





Note: After ‘Unite Shapes’ is selected the text will vanish and it will populate off the canvas. Just drag it back in-place. I have informed OmniGraffle of this odd behavior, and their feedback was “There could be a peculiarity in the object geometry of those text objects in the original Visio file, which made OmniGraffle think that the united object needed to be in an entirely different place on the canvas.”

Omnigraffle efficiency with searchable objects

After years of using the Omnigraffle product, I’m even more in love with some of its hidden features. Following these steps will empower you to search for specific key terms and quickly retrieve correlated objects. Example, if I wanted to find all Horizon View objects such as View Connection Servers, Security Servers, etc. Using this method will save a lot of time instead of scrolling through hundreds of objects.

Defining searchable objects:

1. Create new stencils and save them with a short name, like A1, B1 etc.

2. Inside your new stencil, drag over your old objects or drop in new objects to build-out the stencil

Note: If you want to add more content to the stencil but are running out of room, select ‘New Canvas’

3. Change the Canvas names from ‘Canvas #’ to continue your name-flow, I.e. 1B etc.

4. Select an object you have populated into the new stencil and select the properties gear icon on the far right of your screen.

5. Give your object a name
A) Assign your object a name
B) Enter any other key search values to the object

6. Repeat step 5 for all your objects and save/close your stencil.

Steps to search for an object:

1. Select the root folder (double-click) of where your new stencils resides. This will display ALL objects within the folder.

2. Type a key-phrase you assigned to an object, in my example, ‘earth’

Notice the object now appears! Additionally, the reason I mentioned to save your stencils with a short-name in the first section of this blog is if the name is too long, you will run into this problem:

Long names will make it difficult to search multiple stencils.

Hope that helps others!