mipmip
7/11/2013 - 12:37 PM

appscript indesign z-index research

appscript indesign z-index research

require 'rubygems'
require 'appscript' 
include Appscript

outputDir= File.join(ENV['HOME'],'Desktop')
pdfpath = File.join(outputDir, "myTempFile.pdf")
filepath = File.join(outputDir, "myTempFile.indd")
imagepath = File.join(outputDir, "Schermafbeelding.png")

idApp = app('Adobe InDesign CS4')
myDoc= idApp.make(:new => :document)
myFrame = idApp.documents[1].pages[1].make(:new => :rectangle)
myFrame.geometric_bounds.set(['16p', '16p', '28p', '28p'])

myFrame2 = idApp.documents[1].pages[1].make(:new => :rectangle)
myFrame2.geometric_bounds.set(['6p', '6p', '18p', '18p'])

colorstring = '10,10,10,10'
colors = colorstring.split(',')
if(colors.length == 4)
  nwColor = myDoc.make(:new => :color, :with_properties => {:space => :CMYK, :color_value => [colors[0].to_i, colors[1].to_i, colors[2].to_i, colors[3].to_i]})
	myFrame.fill_color.set(:to => nwColor)
end

colorstring = '40,40,0,0'
colors = colorstring.split(',')
if(colors.length == 4)
	nwColor = myDoc.make(:new => :color, :with_properties => {:space => :CMYK, :color_value => [colors[0].to_i, colors[1].to_i, colors[2].to_i, colors[3].to_i]})
	myFrame2.fill_color.set(:to => nwColor)
end

p myFrame.index.get
p myFrame2.index.get

myFrame.bring_to_front
#p myFrame.methods.grep(/back/)

p myFrame.index.get
p myFrame2.index.get