Skip to content

Instantly share code, notes, and snippets.

@i-blis
Created May 31, 2012 18:43
Show Gist options
  • Save i-blis/2845332 to your computer and use it in GitHub Desktop.
Save i-blis/2845332 to your computer and use it in GitHub Desktop.
Export notes from Keynote to OmniOutliner
#!/usr/bin/env macruby
framework 'scriptingbridge'
keynote = SBApplication.applicationWithBundleIdentifier("com.apple.iWork.Keynote")
outliner = SBApplication.applicationWithBundleIdentifier("com.omnigroup.OmniOutlinerPro3")
document = outliner.classForScriptingClass('document').new
outliner.documents << document
document.get.statusVisible = false
document.get.columnTitleStyle.attributes[29].value = 'center'
column = outliner.classForScriptingClass('column').new
document.columns << column
column.get.title = '#'
column.get.alignment = 1330929969 # misses constant name for center alignment
column.get.index = 2
slideshow = keynote.slideshows.first
slideshow.slides.each do |slide|
document.rows << outliner.classForScriptingClass('row').new
#document.rows.last.cells << outliner.classForScriptingClass('cell').new
cells = document.rows.last.cells
cells.select { |e| e.column.index == 3 }.first.value = slide.notes
cells.select { |e| e.column.index == 2 }.first.value = slide.slideNumber.to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment