PBSmodelling (version 2.69.3)

openFile: Open File with Associated Program

Description

Open a file using the program that the operating system (Windows / Mac OS X / Linux) associates with its type. Users wishing to override the default application can specify a program association using 'setPBSext'.

Usage

openFile(fname="", package=NULL, select=FALSE)

Value

An invisible string vector of the file names and/or commands with file names.

Arguments

fname

character -- vector containing file names to open.

package

character -- (optional) package name; open files relative to this package.

select

logical -- if TRUE, force the use of 'selectFile'.

Author

Alex Couture-Beil, Software Engineer
Earthly Technologies, Victoria BC

Maintainer: Rowan Haigh, Program Head -- Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Regional Headquarters (RHQ), Vancouver BC
Last modified Rd: 2023-01-05

See Also

In package PBSmodelling:
getPBSext, setPBSext, clearPBSext, writePBSoptions

Examples

Run this code
if (FALSE) {
local(envir=.PBSmodEnv,expr={
  # use openFile directly:
  openFile( "doc/PBSmodelling-UG.pdf", package="PBSmodelling" )
})
local(envir=.PBSmodEnv,expr={
  # via doAction in a window description file:
  createWin( "button text=help func=doAction width=20 pady=25 bg=green
  action=\"openFile(`doc/PBSmodelling-UG.pdf`,package=`PBSmodelling`)\"", astext=TRUE)
})
local(envir=.PBSmodEnv,expr={
  # Set up 'Firefox' to open '.html' files (only applicable if Firefox is NOT default web browser)
  setPBSext("html", '"c:/Program Files/Mozilla Firefox/firefox.exe" file://%f')
  openFile("foo.html")
})
}

Run the code above in your browser using DataLab