Skip to content

Instantly share code, notes, and snippets.

@mipmip
Created July 11, 2013 13:39
Show Gist options
  • Save mipmip/5975515 to your computer and use it in GitHub Desktop.
Save mipmip/5975515 to your computer and use it in GitHub Desktop.
InDesign Object Introspection
require 'osx/cocoa'
require 'rubygems'
require 'appscript'
require 'activesupport'
require 'base64'
require 'fileutils'
class InDesignTrospection
include Appscript
def main
inApplication='Adobe InDesign CS4'
@idApp = app(inApplication)
@idDoc = @idApp.active_document.get()
selectedItem = @idDoc.selection
# p selectedItem.index.get
# p selectedItem.class_.get
@idDoc.pages.get.each do |page|
@pageitems = getPageItems(page.id_.get)
end
@pageitems.each do |item|
p item
end
selectedItem.methods.sort.each do |method|
# p method
end
end
def getPageItems(page)
items_arr = Array.new
@idDoc.pages[its.id_.eq(page)].all_page_items.get.each do |item|
items_arr << item.id_.get
end
return items_arr
end
end
obj = InDesignTrospection.new
obj.main
p 'finished :)'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment