[R] RDCOMClient interface - problems setting a variable

Mark Heckmann mark.heckmann at gmx.de
Fri Aug 13 18:39:05 CEST 2010


I try to produce and modify shapes in a PowerPoint presentation but run into a difficulty setting a variable.

library(RDCOMClient)						# load RDCOMClient package
library(SWinTypeLibs)						# package SWinTypeLibs from Omegahat to access information about COM libraries
ppt = COMCreate("PowerPoint.Application")  	# create a ppt COM
ppt[["Visible"]] <-  TRUE						# set COM property visible to TRUE
pres = ppt$Presentations()$Add()				# add a presentation
slide <- pres$Slides()$Add(1,1)								# add slide to presentation
shape1 <- slide$Shapes()$AddShape(92, 200, 200, 100, 100) 	# add a shape object
shape1$Adjustments()$Item(1)				# read adjustment parameter 

How can I change this setting now? Taking a look at the functions available it shows that there are two item() functions - a getter and a setter, but have the same name.

names(getFuncs(shape1$Adjustments()))
str(getFuncs(shape1$Adjustments())[[12]]) 		# getter
str(getFuncs(shape1$Adjustments())[[13]]) 		# setter

In VBA it works like this, supposing the shape is selected:
	ActiveWindow.Selection.ShapeRange.Adjustments.Item(1) = 2  
Here getting and setting is done by appointing a value or not.

I have no clue how to use the setter via R. Can anyone help?
A lot of thanks in advance!!

Mark
–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com



More information about the R-help mailing list