Created
July 11, 2013 13:39
-
-
Save mipmip/5975515 to your computer and use it in GitHub Desktop.
InDesign Object Introspection
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
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