Problem with win32ole to control Adobe InDesign

C

CIURLIA Angelo

Hi,

I'm new to Ruby

I try to control Adobe In design with Ruby

everything was good until i try to assign an enumarated value

if anyone can help me, i provide a sample code to reproduce may error, i ma=
ke many try (at the end of the script) without any success


Thanks in advance

Angelo=20


require 'win32ole'


module INDESIGN_CSX_CONST
end # of INDESIGN_CSX_CONST
#

#launch application
myapplication =3D WIN32OLE.new('InDesign.Application.CS3')

WIN32OLE.const_load(myapplication, INDESIGN_CSX_CONST)

# Create a new document.
myDocument =3D myapplication.Documents.Add
=20
myDocumentPreferences=3DmyDocument.DocumentPreferences

myDocumentPreferences.MasterTextFrame=3Dfalse

myDocumentPreferences.PageWidth=3D200
myDocumentPreferences.PageHeight=3D200

# DESCRIPTION : The number of pages in the document. (Range: 1 to 9999)
myDocumentPreferences.PagesPerDocument=3D5

#myDocumentPreferences.PageOrientation=3D idPortrait # idPageOrientation=20
# Enum idPageOrientation
# CONSTANT I4 idLandscape =3D 2003395685
# CONSTANT I4 idPortrait =3D 1751738216


#myDocumentPreferences.PageOrientation=3D 1751738216
#sample_rb_pb_ml.rb:35:in `method_missing': (WIN32OLERuntimeError)
# OLE error code:30477 in C:\gb_test\program\Adobe_InDesign_CS3\Adobe In=
Design CS3\InDesign.exe
# Valeur incorrecte pour la propri=C3=A9t=C3=A9 d=C3=A9finie =C3=86Pag=
eOrientation=C3=86. Attendait idPageOrientation enumerator, mais a re=C3=BE=
u 1751738216.0.
# HRESULT error code:0x80020009
# Une exception s'est produite. from sample_rb_pb_ml.rb:35
#

#myDocumentPreferences.PageOrientation=3D IdPortrait # idPageOrientation=20
#sample_rb_pb_ml.rb:40: uninitialized constant IdPortrait (NameError)

#myDocumentPreferences.PageOrientation=3D IdPageOrientation::IdPortrait=20
#sample_rb_pb_ml.rb:42: uninitialized constant IdPageOrientation (NameError=
)

#myDocumentPreferences.PageOrientation=3D INDESIGN_CSX_CONST::IdPageOrienta=
tion::IdPortrait=20
#sample_rb_pb_ml.rb:46: uninitialized constant INDESIGN_CSX_CONST::IdPageOr=
ientation (NameError)

myDocumentPreferences.PageOrientation=3D INDESIGN_CSX_CONST::IdPortrait=20
#sample_rb_pb_ml.rb:49:in `method_missing': (WIN32OLERuntimeError)
# OLE error code:30477 in C:\gb_test\program\Adobe_InDesign_CS3\Adobe In=
Design CS3\InDesign.exe
# Valeur incorrecte pour la propri=C3=A9t=C3=A9 d=C3=A9finie "PageOrie=
ntation". Attendait idPageOrientation enumerator, mais a re=C3=A7u 17517382=
16.0.
# HRESULT error code:0x80020009
# Une exception s'est produite. from sample_rb_pb_ml.rb:49
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top