You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/applescript.R
|
|
\name{applescript}
|
|
\alias{applescript}
|
|
\title{Execute AppleScript and Return Results}
|
|
\usage{
|
|
applescript(script_source, extra_args = c(), params = c())
|
|
}
|
|
\arguments{
|
|
\item{script_source}{character vector of valid applescript source lines.
|
|
They will be turned into a single script file with a newline inserted
|
|
between each element of the vector.}
|
|
|
|
\item{extra_args}{the \code{applescript} binary takes arguments but we only
|
|
use the filename execution so you can place any other arguments
|
|
for it here. NOTE that there is a separate parameter for specifying
|
|
parameters}
|
|
|
|
\item{param}{a character vector of parameters to pass to the invokation.}
|
|
}
|
|
\value{
|
|
anything the script returns (invisibly).
|
|
}
|
|
\description{
|
|
Execute AppleScript and Return Results
|
|
}
|
|
\note{
|
|
\code{stdout} is captured and returned but \code{stderr} (if any) is displayed in the console.
|
|
}
|
|
\examples{
|
|
\dontrun{
|
|
# open a folder
|
|
applescript(
|
|
sprintf(
|
|
'tell app "Finder" to open POSIX file "\%s"',
|
|
Sys.getenv("R_DOC_DIR")
|
|
)
|
|
)
|
|
|
|
|
|
# talk to an app and return data
|
|
res <- applescript('
|
|
tell application "iTunes"
|
|
set r_name to name of current track
|
|
set r_artist to artist of current track
|
|
end
|
|
return "artist=" & r_artist & " || track=" & r_name
|
|
')
|
|
|
|
print(res)
|
|
}
|
|
}
|
|
|