I'm sending a command to open a PDF file from within an R script.  The
actual command
is system dependent, and I'm trying to figure out how I determine the script
is running on
a Mac, so that the correct command is used.  I don't have a Mac available to
verify this
section of the code.

    help_button <- tkbutton(my_main_win,
                        text="PDF Manual",
                        anchor="w",
                        command=function() {
                            my_dir = getwd()
                            src_dir <-
paste(tclObj(Source_dir),sep="",collapse=" ")
                            setwd(src_dir)
                            # "RADAR_documentation_0v6p5.pdf"
                            if
(as.character(Sys.info()["sysname"])=="Windows") {
                                command_str = "cmd /c start
RADAR_documentation_0v6p5.pdf"
                            } else if
(as.character(Sys.info()["sysname"])=="Mac") {
                                command_str = "open
RADAR_documentation_0v6p5.pdf"
                            } else { # linux
                                command_str = "xdg-open
RADAR_documentation_0v6p5.pdf"
                            }
                            system(command_str)
                            setwd(my_dir)
                        })
    tkpack(help_button,side="top",padx="10m",fill="x")


Hopefully I'm sending this to the appropriate email address.

Thanks,

DaveG


PS

If you are curious as to what RADAR is in the above code...
http://sites.google.com/site/stdfradar/

	[[alternative HTML version deleted]]

