# Problem with win32ole to control Adobe InDesign

**URL:** <https://www.ruby-forum.com/t/problem-with-win32ole-to-control-adobe-indesign/128513>\
**Category:** Ruby\
**Created:** [February 8, 2008, 10:54am UTC](https://www.ruby-forum.com/t/problem-with-win32ole-to-control-adobe-indesign/128513 "2008-02-08T10:54:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CIURLIA\_Angelo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CIURLIA\_Angelo](https://www.ruby-forum.com/u/CIURLIA_Angelo)\
**Post date:** [February 8, 2008, 10:54am UTC](https://www.ruby-forum.com/t/problem-with-win32ole-to-control-adobe-indesign/128513/1 "2008-02-08T10:54:08Z")

</div>

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  
make many try (at the end of the script) without any success

Thanks in advance

Angelo

require ‘win32ole’

module INDESIGN\_CSX\_CONST  
end # of INDESIGN\_CSX\_CONST

# 

#launch application  
myapplication = WIN32OLE.new(‘InDesign.Application.CS3’)

WIN32OLE.const\_load(myapplication, INDESIGN\_CSX\_CONST)

# Create a new document.

myDocument = myapplication.Documents.Add

myDocumentPreferences=myDocument.DocumentPreferences

myDocumentPreferences.MasterTextFrame=false

myDocumentPreferences.PageWidth=200  
myDocumentPreferences.PageHeight=200

# DESCRIPTION : The number of pages in the document. (Range: 1 to 9999)

myDocumentPreferences.PagesPerDocument=5

#myDocumentPreferences.PageOrientation= idPortrait # idPageOrientation

# Enum idPageOrientation

# CONSTANT I4 idLandscape = 2003395685

# CONSTANT I4 idPortrait = 1751738216

#myDocumentPreferences.PageOrientation= 1751738216  
#sample\_rb\_pb\_ml.rb:35:in `method\_missing’: (WIN32OLERuntimeError)

# OLE error code:30477 in C:\gb\_test\program\Adobe\_InDesign\_CS3\Adobe

InDesign CS3\InDesign.exe

# Valeur incorrecte pour la propriÃ©tÃ© dÃ©finie Ã†PageOrientationÃ†.

Attendait idPageOrientation enumerator, mais a reÃ¾u 1751738216.0.

# HRESULT error code:0x80020009

# Une exception s’est produite. from sample\_rb\_pb\_ml.rb:35

# 

#myDocumentPreferences.PageOrientation= IdPortrait # idPageOrientation  
#sample\_rb\_pb\_ml.rb:40: uninitialized constant IdPortrait (NameError)

#myDocumentPreferences.PageOrientation= IdPageOrientation::IdPortrait  
#sample\_rb\_pb\_ml.rb:42: uninitialized constant IdPageOrientation  
(NameError)

#myDocumentPreferences.PageOrientation=  
INDESIGN\_CSX\_CONST::IdPageOrientation::IdPortrait  
#sample\_rb\_pb\_ml.rb:46: uninitialized constant  
INDESIGN\_CSX\_CONST::IdPageOrientation (NameError)

myDocumentPreferences.PageOrientation= INDESIGN\_CSX\_CONST::IdPortrait  
#sample\_rb\_pb\_ml.rb:49:in `method\_missing’: (WIN32OLERuntimeError)

# OLE error code:30477 in C:\gb\_test\program\Adobe\_InDesign\_CS3\Adobe

InDesign CS3\InDesign.exe

# Valeur incorrecte pour la propriÃ©tÃ© dÃ©finie “PageOrientation”.

Attendait idPageOrientation enumerator, mais a reÃ§u 1751738216.0.

# HRESULT error code:0x80020009

# Une exception s’est produite. from sample\_rb\_pb\_ml.rb:49
