Richard M. Heiberger
2007-May-11 23:37 UTC
[R] shell.exec() on Windows, unexpected behavior
I have Windows XP machines with different software configurations. My laptop has Adobe Reader 8 and Adobe Acrobat 6. My desktop has Adobe Reader 8 and does not have Adobe Acrobat. On both machines, PDF extensions are registered to Adobe Reader 8.0, and double-clicking a pdf file in Windows Explorer opens Adobe Reader 8.0. In R-2.5.0, with all Adobe windows closed, the command shell.exec('c:/Program Files/R/R-2.5.0/doc/manual/R-admin.pdf') opens an Adobe window. On the laptop, it opens Adobe Acrobat 6.0. On the desktop, it opens Adobe Reader 8.0. When an Adobe window is aleady open, shell.exec() uses the already open Adobe window. Neither machine has any Adobe directories in the shell("PATH"). I am puzzled by shell.exec() opening "Adobe Acrobat" when the file extension is registered to "Acrobat Reader". The documentation in ?shell.exec says "Opens the specified file or URL using the application specified in the Windows file associations." thanks Rich
Just a guess but perhaps it opens the file with the association that existed when R was installed and that association was different from the current association? Try re-installing R and see if that changes it. On 5/11/07, Richard M. Heiberger <rmh at temple.edu> wrote:> I have Windows XP machines with different software configurations. > My laptop has Adobe Reader 8 and Adobe Acrobat 6. > My desktop has Adobe Reader 8 and does not have Adobe Acrobat. > > On both machines, PDF extensions are registered to Adobe Reader 8.0, > and double-clicking a pdf file in Windows Explorer opens Adobe Reader > 8.0. > > In R-2.5.0, with all Adobe windows closed, the command > shell.exec('c:/Program Files/R/R-2.5.0/doc/manual/R-admin.pdf') > opens an Adobe window. > On the laptop, it opens Adobe Acrobat 6.0. > On the desktop, it opens Adobe Reader 8.0. > > When an Adobe window is aleady open, shell.exec() uses the already > open Adobe window. > > Neither machine has any Adobe directories in the shell("PATH"). > > I am puzzled by shell.exec() opening "Adobe Acrobat" when the file > extension is registered to "Acrobat Reader". The documentation in > ?shell.exec says "Opens the specified file or URL using the > application specified in the Windows file associations." > > > thanks > Rich > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On 11/05/2007 7:37 PM, Richard M. Heiberger wrote:> I have Windows XP machines with different software configurations. > My laptop has Adobe Reader 8 and Adobe Acrobat 6. > My desktop has Adobe Reader 8 and does not have Adobe Acrobat. > > On both machines, PDF extensions are registered to Adobe Reader 8.0, > and double-clicking a pdf file in Windows Explorer opens Adobe Reader > 8.0. > > In R-2.5.0, with all Adobe windows closed, the command > shell.exec('c:/Program Files/R/R-2.5.0/doc/manual/R-admin.pdf') > opens an Adobe window. > On the laptop, it opens Adobe Acrobat 6.0. > On the desktop, it opens Adobe Reader 8.0. > > When an Adobe window is aleady open, shell.exec() uses the already > open Adobe window. > > Neither machine has any Adobe directories in the shell("PATH"). > > I am puzzled by shell.exec() opening "Adobe Acrobat" when the file > extension is registered to "Acrobat Reader". The documentation in > ?shell.exec says "Opens the specified file or URL using the > application specified in the Windows file associations."shell.exec("foo.pdf") does the same thing that "start foo.pdf" would do from a Windows command line. Do you see the same behaviour there? I think this is also usually the same thing as a right click Open does, but that may be changeable. What may be happening is that Acrobat has installed some fancy shell extension that doesn't execute an "open" on the file, it does something else instead. Duncan Murdoch
Richard; Windows file open behaviour is dictated by the complete set of file associations in the windows registry. You can inspect them in Explorer via tools|folder options|File types, by finding the file type and looking at the advanced options. I would suspect that installing acrobat and the reader in different order on different machines will have changed the default file open action. You can override the defaults by specifying your own. but it will have essentially nothing to do with R... you should see the same behaviour in explorer.>>> "Richard M. Heiberger" <rmh at temple.edu> 12/05/2007 00:37:13 >>>I have Windows XP machines with different software configurations. My laptop has Adobe Reader 8 and Adobe Acrobat 6. My desktop has Adobe Reader 8 and does not have Adobe Acrobat. On both machines, PDF extensions are registered to Adobe Reader 8.0, and double-clicking a pdf file in Windows Explorer opens Adobe Reader 8.0. In R-2.5.0, with all Adobe windows closed, the command shell.exec('c:/Program Files/R/R-2.5.0/doc/manual/R-admin.pdf') opens an Adobe window. On the laptop, it opens Adobe Acrobat 6.0. On the desktop, it opens Adobe Reader 8.0. When an Adobe window is aleady open, shell.exec() uses the already open Adobe window. Neither machine has any Adobe directories in the shell("PATH"). I am puzzled by shell.exec() opening "Adobe Acrobat" when the file extension is registered to "Acrobat Reader". The documentation in ?shell.exec says "Opens the specified file or URL using the application specified in the Windows file associations." thanks Rich ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ******************************************************************* This email and any attachments are confidential. Any use, co...{{dropped}}