Description Usage Arguments Value Note Examples
Execute AppleScript and Return Results
1 | applescript(script_source, extra_args = c(), params = c())
|
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. |
extra_args |
the |
param |
a character vector of parameters to pass to the invokation. |
anything the script returns (invisibly).
stdout
is captured and returned but stderr
(if any) is displayed in the console.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
# 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.