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.