[Rd] calling browser in Windows
Ben Bolker
bolker@zoo.ufl.edu
Tue, 2 Oct 2001 14:53:57 -0400 (EDT)
I'm working on the interface to LiveGraphics3D (Java applet for dynamic
3D graphics) that I mentioned earlier on the list, and I've hit a
cross-platform problem.
I want to allow the option of popping up a browser or opening the file
in a browser automatically. On Unix, the following (stolen from
help.start()) works:
system(paste(browser, " -remote \"openURL(", url, ")\" 2>/dev/null || ",
browser, " ", url, " &", sep = ""))
If I want to do this in Windows, options("browser") is NULL. (For now I'm
hardcoding browser to "C:/PROGRA~1/INTERN~1/IEXPLORE.EXE", but this
clearly isn't a general solution.) The syntax of the call is also
different (IE at least appears to require just the file name, "file:/"
just seems to confuse it). I don't know how to start a browser in the
background, or do the equivalent of -remote ... help.start() is
considerably more internalized on Windows, so I'm not getting much useful
there.
Here's what I'm doing now:
mach <- machine()
if (mach=="Unix") {
url <- paste("file:",file.path(getwd(),fn),sep="")
system(paste(browser, " -remote \"openURL(", url, ")\" 2>/dev/null ||
",
browser, " ", url, " &", sep = ""))
}
else if (mach=="Windows") {
system(paste(browser,file.path(getwd(),fn)))
}
}
Is there a different idiom I should be using for Windows?
I suppose it's all completely different for the Mac too ...
Might it be possible to standardize this interface?
thanks,
Ben Bolker
--
318 Carr Hall bolker@zoo.ufl.edu
Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
Box 118525 (ph) 352-392-5697
Gainesville, FL 32611-8525 (fax) 352-392-3704
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._