COMAccessors: COM Object Accesors

COMAccessorsR Documentation

COM Object Accesors

Description

These operators provide a more S-like syntax for accessing methods and properties in a dynamic COM object. One calls a COM object method using the $ operator. The values of COM object properties are retrieved and set using [[ and [[<-, respectively.

Value

Setting a property returns NULL.

Invoking a method and getting a property value returns an S object representing the COM value. Primitive COM values are converted to the corresponding S objects. COM objects are returned as COMIDispatch objects.

Methods

x = "COMIDispatch"

the COMIDispatch object whose method or property is to be invoked.

Author(s)

Duncan Temple Lang (duncan@r-project.org)

References

http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry

See Also

.COM COMCreate

COMList-class COMTypedList-class COMTypedNamedList-class

Examples

 e <- COMCreate("Excel.Application")

  # Boolean/Logical
 e[["Visible"]]
  # Setting a value.
 e[["Visible"]] <- TRUE

  # String
 e[["Path"]]
 e[["Version"]]

  # Double
 e[["Width"]]

  # Long
 e[["SheetsInNewWorkbook"]]
 
  # Object
 books <- e[["Workbooks"]]

 books$Add()

  # Use this as a container, so can have integer indices, 1-based.
 books[[1]]
 e[["Workbooks"]][[1]]

## Not run: 
 books$Open("C:\mySheet.xls")

## End(Not run)

 e$CheckSpelling("This is a spell check") # okay
 e$CheckSpelling("This is a spell chck") # error

## Not run:  
 e$SaveWorkspace()

## End(Not run)
 e$Quit()

 rm(list= c("e", "books"))
 gc()


omegahat/RDCOMClient documentation built on July 24, 2022, 5:45 a.m.