Hi, Under Mojave, applescripts from Textmate to R.app have broken.
I thought this would be fixed by adding TextMate and R.app to the apps allowed to control my computer (prefs: security: privacy: accessibility)
But seems not. This repro script runs properly from terminal osascript -e 'tell application "R" to cmd "2+2" '
But from textmate, the script below activates R.app, but doesn’t execute cmd in R…
Any thought?
This is the script of the TM command I use to send the selection to R.app
#!/usr/bin/env bash
# input is selection or document rawText="`cat`"
curDir='' if [[ ${#TM_DIRECTORY} -gt 0 ]]; then curDir="$TM_DIRECTORY" fi
osascript -e 'on run(theCode)' \ -e 'tell application "R" to activate' \ -e 'if (item 2 of theCode) is not "" then tell application "R" to cmd "setwd('''" & (item 2 of theCode) & "''')"' \ -e 'tell application "R" to cmd (item 1 of theCode)' \ -e 'end run' -- "$rawText" "$curDir"
On Jun 30, 2018, at 12:01 PM, Tim Bates timothy.c.bates@gmail.com wrote:
I thought this would be fixed by adding TextMate and R.app to the apps allowed to control my computer (prefs: security: privacy: accessibility)
I’m not running Mojave yet, but have you tried adding the apps under “Application Data” too?
-Ron
On 1 Jul 2018, at 2:56, Ronald Wampler wrote:
I’m not running Mojave yet, but have you tried adding the apps under “Application Data” too?
Also not on Mojave but I read this blog post: https://www.felix-schwarz.org/blog/2018/06/apple-event-sandboxing-in-macos-m...
It points to these shortcomings (direct quotes):
1. Even if trusting an app targeting a large (or even open-ended) list of other apps, users can't whitelist it to avoid constantly running into auth prompts.
2. Authorization can't be re-requested. F.ex. in response to a click on an "Authorize" button in an alert stating that the app lacks a permission.
I take that to mean that there is (currently) no way for the user to say that TextMate is allowed to send AppleEvents to any app on the system, and if the user (accidentally) clicks something other than “Authorize” the first time that TextMate sends an AppleEvent to e.g. R.app, there is no way for TextMate to bring up this dialog again, and probably no way for the user to manually add R.app as one of the apps TextMate is allowed to send AppleEvents to.
Maybe `tccutil` can be used to reset the list of “denied” applications. Try `man tccutil` in Mojave and see if anything is written about AppleEvents.
On 1 Jul 2018, at 8:59 pm, Allan Odgaard mailinglist@textmate.org wrote:
On 1 Jul 2018, at 2:56, Ronald Wampler wrote: I’m not running Mojave yet, but have you tried adding the apps under “Application Data” too?
Thanks Ronald, but adding TM and R.app to “Application Data” too didn’t help.
Also not on Mojave but I read this blog post: https://www.felix-schwarz.org/blog/2018/06/apple-event-sandboxing-in-macos-m...
It points to these shortcomings (direct quotes):
• Even if trusting an app targeting a large (or even open-ended) list of other apps, users can't whitelist it to avoid constantly running into auth prompts.
• Authorization can't be re-requested. F.ex. in response to a click on an "Authorize" button in an alert stating that the app lacks a permission.
I take that to mean that there is (currently) no way for the user to say that TextMate is allowed to send AppleEvents to any app on the system, and if the user (accidentally) clicks something other than “Authorize” the first time that TextMate sends an AppleEvent to e.g. R.app, there is no way for TextMate to bring up this dialog again, and probably no way for the user to manually add R.app as one of the apps TextMate is allowed to send AppleEvents to.
I don’t think I rejected the dialog. I saw it for an osascript calling command I have in TM to pull in the path to the currently open folder in the Finder, and I got the dialog and the command worked.
Maybe something did go wrong first time with R
Maybe tccutil can be used to reset the list of “denied” applications. Try man tccutil in Mojave and see if anything is written about AppleEvents.
man page has a date of 2012. reset fails
me:OpenMx tim$ tccutil reset R.app tccutil: Failed to reset database
I tried operating R via terminal, and that worked fine:
osascript -e ‘tell application “R" to cmd "2+2" ' Yuck… will need to find a way to re-request authorisation, but the look of it. I will try this on a different machine on Monday and let you know the outcome.
Everything else is ticketey-boo
t