omegahat / RDCOMClient

GNU General Public License v2.0
80 stars 35 forks source link

Trying to install RDCOMClient on R 4.2.0 #37

Closed spsanderson closed 2 years ago

spsanderson commented 2 years ago

I am trying to install RDCOMClient on R 4.2.0 This is what I get in the console:

R version 4.2.0 (2022-04-22 ucrt) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("RDCOMClient", repos = "http://www.omegahat.net/R")
Installing package into 'C:/Users/bha485/AppData/Local/R/win-library/4.2'
(as 'lib' is unspecified)
Warning: unable to access index for repository http://www.omegahat.net/R/bin/windows/contrib/4.2:
  cannot open URL 'http://www.omegahat.net/R/bin/windows/contrib/4.2/PACKAGES'
Package which is only available in source form, and may need
  compilation of C/C++/Fortran: 'RDCOMClient'
Do you want to attempt to install these from sources? (Yes/no/cancel) y
installing the source package 'RDCOMClient'

trying URL 'http://www.omegahat.net/R/src/contrib/RDCOMClient_0.93-0.tar.gz'
Content type 'application/x-gzip' length 49509 bytes (48 KB)
downloaded 48 KB

* installing *source* package 'RDCOMClient' ...
** using staged installation
** libs
g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -D_GNU_ -DNO_PYCOM_IPROVIDECLASSINFO -I.    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"  -Wno-deprecated    -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c COMError.cpp -o COMError.o
COMError.cpp:347: warning: "_countof" redefined
  347 | #define _countof(array) (sizeof(array)/sizeof(array[0]))
      | 
In file included from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\c++\cstdlib:75,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\c++\stdlib.h:36,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\mm_malloc.h:27,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\xmmintrin.h:34,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\immintrin.h:29,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\lib\gcc\x86_64-w64-mingw32.static.posix\10.3.0\include\x86intrin.h:32,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\include\winnt.h:1555,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\include\minwindef.h:163,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\include\windef.h:9,
                 from c:\rtools42\x86_64-w64-mingw32.static.posix\include\windows.h:69,
                 from RCOMObject.h:23,
                 from COMError.cpp:1:
c:\rtools42\x86_64-w64-mingw32.static.posix\include\stdlib.h:381: note: this is the location of the previous definition
  381 | #define _countof(_Array) sizeof(*__countof_helper(_Array))
      | 
In file included from COMError.cpp:1:
RCOMObject.h: In member function 'virtual ULONG RCOMObject::Release()':
RCOMObject.h:61:43: warning: deleting object of abstract class type 'RCOMObject' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
   61 |                                           delete this;
      |                                           ^~~~~~~~~~~
COMError.cpp: In function 'void GetScodeString(HRESULT, LPTSTR, int)':
COMError.cpp:371:16: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'HRESULT' {aka 'long int'} [-Wformat=]
  371 |  sprintf(buf, ("OLE error 0x%08x"), hr);
      |               ~^~~~~~~~~~~~~~~~~~~  ~~
      |                                     |
      |                                     HRESULT {aka long int}
COMError.cpp: In function 'HRESULT checkErrorInfo(IUnknown*, HRESULT, SEXPREC**)':
COMError.cpp:409:38: warning: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'HRESULT' {aka 'long int'} [-Wformat=]
  409 |   fprintf(stderr, "<checkErrorInfo> %X \n", status);
      |                                     ~^      ~~~~~~
      |                                      |      |
      |                                      |      HRESULT {aka long int}
      |                                      unsigned int
      |                                     %lX
COMError.cpp:470:4: error: 'PROBLEM' was not declared in this scope
  470 |    PROBLEM "%s", str
      |    ^~~~~~~
COMError.cpp:477:4: error: 'PROBLEM' was not declared in this scope
  477 |    PROBLEM "%s (%s)", str, FromBstr(ostr)
      |    ^~~~~~~
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:259: COMError.o] Error 1
ERROR: compilation failed for package 'RDCOMClient'
* removing 'C:/Users/bha485/AppData/Local/R/win-library/4.2/RDCOMClient'

The downloaded source packages are in
    'C:\Users\bha485\AppData\Local\Temp\RtmpOOxyJr\downloaded_packages'
Warning message:
In install.packages("RDCOMClient", repos = "http://www.omegahat.net/R") :
  installation of package 'RDCOMClient' had non-zero exit status
MichaelBissell commented 2 years ago

I get the same thing when using install.packages("RDCOMClient", repos = "http://www.omegahat.net/R") However, similar to https://github.com/omegahat/RDCOMClient/issues/32 if I use devtools::install_github("omegahat/RDCOMClient") then this installation seems to work and can load the package using library() but also get fatal errors (session abort, RStudio bomb). The 'COMCreate()' works ok but the 'Outlook$CreateItem(0)' is what gives the session abort, RStudio bomb.

Outlook <- COMCreate("Outlook.Application")

  Email = Outlook$CreateItem(0)
  Email[["to"]] = to
  Email[["subject"]] = subject
  Email[["body"]] = body # If no body, then email comes with an attachment

  Email$Send()

Any solutions would be greatly appreciated! I love using this to send an email when a batch job is done.

duncantl commented 2 years ago

I've pushed numerous changes to RDCOMClient and related packages now that I have a Windows setup in place (!). The outlook example works fine with this installation, at leas on my machine.

The logging of errors is now off, by default, and can be turned on by a call to an R function (writeErrors()) and one can specify the name of the file to which the information will be written.

MichaelBissell commented 2 years ago

Confirmed that the devtools::install_github("omegahat/RDCOMClient") works on R version 4.2.0 (2022-04-22 ucrt) and 2022.02.3+492 Prairie Trillium (desktop) and also that the Outlook example above works correctly now.

You are the best, thank you kind sir!

spsanderson commented 2 years ago

Amazing! works!

RikSchoemaker commented 2 years ago

Hi Duncan,

This is awesome! It compiles and I get a lot of the functionality, but some things don’t seem to work, and a crucial one for me is illustrated by the following:

library("RDCOMClient")

Error logging

f<-writeErrors(TRUE)

Starts the Word application with WordApp as handle

WordApp <- RDCOMClient::COMCreate("Word.Application")

And makes it visible

WordApp[["Visible"]] <- TRUE

readLines(f)

[1] "FUNCDESC 2" "readOnly. 1"

The Word application is not made visible for me so I cannot see what’s happening while I run my scripts at the Word end. It seems to work fine with PowerPoint. Has the ability to assign attributes to handles been modified perhaps, and set to read only?

Kind regards,

Rik Schoemaker

From: Duncan Temple Lang @.> Sent: 15 July 2022 06:21 To: omegahat/RDCOMClient @.> Cc: Subscribed @.***> Subject: Re: [omegahat/RDCOMClient] Trying to install RDCOMClient on R 4.2.0 (Issue #37)

I've pushed numerous changes to RDCOMClient and related packages now that I have a Windows setup in place (!). The outlook example works fine with this installation, at leas on my machine.

The logging of errors is now off, by default, and can be turned on by a call to an R function (writeErrors()) and one can specify the name of the file to which the information will be written.

— Reply to this email directly, view it on GitHubhttps://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1185157772, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPJYF6N6JX3HQD652QTA7DVUDRI5ANCNFSM5Y3POL6A. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

duncantl commented 2 years ago

Hi Rik

I thought you were on vacation!

Thanks for pointing this out. It works for Excel which is what I tested. I have put a new version on github and the omegahat repository which fixes the issue. I was adding the ability to chain assignments to properties such as x[["Interior"]][["ColorIndex"]] = 3 without getting an error as one can not assign to the Interior property. So I am handling it slightly differently for now. Thanks again Duncan

On Fri, Jul 15, 2022 at 11:41 PM Rik Schoemaker @.***> wrote:

Hi Duncan,

This is awesome! It compiles and I get a lot of the functionality, but some things don’t seem to work, and a crucial one for me is illustrated by the following:

library("RDCOMClient")

Error logging

f<-writeErrors(TRUE)

Starts the Word application with WordApp as handle

WordApp <- RDCOMClient::COMCreate("Word.Application")

And makes it visible

WordApp[["Visible"]] <- TRUE

readLines(f)

[1] "FUNCDESC 2" "readOnly. 1"

The Word application is not made visible for me so I cannot see what’s happening while I run my scripts at the Word end. It seems to work fine with PowerPoint. Has the ability to assign attributes to handles been modified perhaps, and set to read only?

Kind regards,

Rik Schoemaker

From: Duncan Temple Lang @.> Sent: 15 July 2022 06:21 To: omegahat/RDCOMClient @.> Cc: Subscribed @.***> Subject: Re: [omegahat/RDCOMClient] Trying to install RDCOMClient on R 4.2.0 (Issue #37)

I've pushed numerous changes to RDCOMClient and related packages now that I have a Windows setup in place (!). The outlook example works fine with this installation, at leas on my machine.

The logging of errors is now off, by default, and can be turned on by a call to an R function (writeErrors()) and one can specify the name of the file to which the information will be written.

— Reply to this email directly, view it on GitHub< https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1185157772>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AFPJYF6N6JX3HQD652QTA7DVUDRI5ANCNFSM5Y3POL6A>.

You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHub https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYAGIXYGKUIFJGMLHAY6DVUJKQ7ANCNFSM5Y3POL6A . You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "url": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": " https://github.com" } } ]

--

Duncan Temple Lang Associate Dean for Graduate Programs Professor, Department of Statistics UC Davis

RikSchoemaker commented 2 years ago

Hi Duncan, Thanks!! Yes, I’m on vacation, but this is very important to us :-). Don’t know how soon I can test it out but will feed back as soon as I can! Cheers, Rik

On 16 Jul 2022, at 21:37, Duncan Temple Lang @.***> wrote:



Hi Rik

I thought you were on vacation!

Thanks for pointing this out. It works for Excel which is what I tested. I have put a new version on github and the omegahat repository which fixes the issue. I was adding the ability to chain assignments to properties such as x[["Interior"]][["ColorIndex"]] = 3 without getting an error as one can not assign to the Interior property. So I am handling it slightly differently for now. Thanks again Duncan

On Fri, Jul 15, 2022 at 11:41 PM Rik Schoemaker @.***> wrote:

Hi Duncan,

This is awesome! It compiles and I get a lot of the functionality, but some things don’t seem to work, and a crucial one for me is illustrated by the following:

library("RDCOMClient")

Error logging

f<-writeErrors(TRUE)

Starts the Word application with WordApp as handle

WordApp <- RDCOMClient::COMCreate("Word.Application")

And makes it visible

WordApp[["Visible"]] <- TRUE

readLines(f)

[1] "FUNCDESC 2" "readOnly. 1"

The Word application is not made visible for me so I cannot see what’s happening while I run my scripts at the Word end. It seems to work fine with PowerPoint. Has the ability to assign attributes to handles been modified perhaps, and set to read only?

Kind regards,

Rik Schoemaker

From: Duncan Temple Lang @.> Sent: 15 July 2022 06:21 To: omegahat/RDCOMClient @.> Cc: Subscribed @.***> Subject: Re: [omegahat/RDCOMClient] Trying to install RDCOMClient on R 4.2.0 (Issue #37)

I've pushed numerous changes to RDCOMClient and related packages now that I have a Windows setup in place (!). The outlook example works fine with this installation, at leas on my machine.

The logging of errors is now off, by default, and can be turned on by a call to an R function (writeErrors()) and one can specify the name of the file to which the information will be written.

— Reply to this email directly, view it on GitHub< https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1185157772>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AFPJYF6N6JX3HQD652QTA7DVUDRI5ANCNFSM5Y3POL6A>.

You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHub https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYAGIXYGKUIFJGMLHAY6DVUJKQ7ANCNFSM5Y3POL6A . You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "url": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": " https://github.com" } } ]

--

Duncan Temple Lang Associate Dean for Graduate Programs Professor, Department of Statistics UC Davis

— Reply to this email directly, view it on GitHubhttps://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186274704, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPJYF6X3FF3EYGVOT7JU33VUMFPVANCNFSM5Y3POL6A. You are receiving this because you commented.Message ID: @.***>

RikSchoemaker commented 2 years ago

Hi Duncan,

I couldn’t resist 😊 You really pulled it off; everything seems to be working exactly like it should!! You star, thank you so much!

Kind regards,

Rik

From: Rik Schoemaker @.> Sent: 16 July 2022 23:00 To: omegahat/RDCOMClient @.> Subject: Re: [omegahat/RDCOMClient] Trying to install RDCOMClient on R 4.2.0 (Issue #37)

Hi Duncan, Thanks!! Yes, I’m on vacation, but this is very important to us :-). Don’t know how soon I can test it out but will feed back as soon as I can! Cheers, Rik

On 16 Jul 2022, at 21:37, Duncan Temple Lang @.**@.>> wrote:  Hi Rik

I thought you were on vacation!

Thanks for pointing this out. It works for Excel which is what I tested. I have put a new version on github and the omegahat repository which fixes the issue. I was adding the ability to chain assignments to properties such as x[["Interior"]][["ColorIndex"]] = 3 without getting an error as one can not assign to the Interior property. So I am handling it slightly differently for now. Thanks again Duncan

On Fri, Jul 15, 2022 at 11:41 PM Rik Schoemaker @.<mailto:@.>> wrote:

Hi Duncan,

This is awesome! It compiles and I get a lot of the functionality, but some things don’t seem to work, and a crucial one for me is illustrated by the following:

library("RDCOMClient")

Error logging

f<-writeErrors(TRUE)

Starts the Word application with WordApp as handle

WordApp <- RDCOMClient::COMCreate("Word.Application")

And makes it visible

WordApp[["Visible"]] <- TRUE

readLines(f)

[1] "FUNCDESC 2" "readOnly. 1"

The Word application is not made visible for me so I cannot see what’s happening while I run my scripts at the Word end. It seems to work fine with PowerPoint. Has the ability to assign attributes to handles been modified perhaps, and set to read only?

Kind regards,

Rik Schoemaker

From: Duncan Temple Lang @.<mailto:@.>> Sent: 15 July 2022 06:21 To: omegahat/RDCOMClient @.<mailto:@.>> Cc: Subscribed @.<mailto:@.>> Subject: Re: [omegahat/RDCOMClient] Trying to install RDCOMClient on R 4.2.0 (Issue #37)

I've pushed numerous changes to RDCOMClient and related packages now that I have a Windows setup in place (!). The outlook example works fine with this installation, at leas on my machine.

The logging of errors is now off, by default, and can be turned on by a call to an R function (writeErrors()) and one can specify the name of the file to which the information will be written.

— Reply to this email directly, view it on GitHub< https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1185157772>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AFPJYF6N6JX3HQD652QTA7DVUDRI5ANCNFSM5Y3POL6A>.

You are receiving this because you are subscribed to this thread.Message ID: @.**@.mailto:***@***.******@***.***>>

— Reply to this email directly, view it on GitHub https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYAGIXYGKUIFJGMLHAY6DVUJKQ7ANCNFSM5Y3POL6A . You are receiving this because you commented.Message ID: @.<mailto:@.>> [ { @.<mailto:@.>": "http://schema.org", @.<mailto:@.>": "EmailMessage", "potentialAction": { @.<mailto:@.>": "ViewAction", "target": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "url": " https://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186101863", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.<mailto:@.>": "Organization", "name": "GitHub", "url": " https://github.com" } } ]

--

Duncan Temple Lang Associate Dean for Graduate Programs Professor, Department of Statistics UC Davis

— Reply to this email directly, view it on GitHubhttps://github.com/omegahat/RDCOMClient/issues/37#issuecomment-1186274704, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPJYF6X3FF3EYGVOT7JU33VUMFPVANCNFSM5Y3POL6A. You are receiving this because you commented.Message ID: @.**@.>>