<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span style="font-size: 17px;" class="">Hi,</span><div style="font-size: 17px;" class="">Under Mojave, applescripts from Textmate  to R.app have broken.</div><div style="font-size: 17px;" class=""><br class=""></div><div style="font-size: 17px;" class="">I thought this would be fixed by adding TextMate and R.app to the apps allowed to control my computer </div><div style="font-size: 17px;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(prefs: security: privacy: accessibility)</div><div style="font-size: 17px;" class=""><br class=""></div><div style="font-size: 17px;" class="">But seems not. This repro script runs properly from terminal</div><div style="font-size: 17px;" class=""><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Courier; color: rgb(59, 35, 34); background-color: rgb(215, 211, 183);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">osascript -e 'tell application "R" to cmd "2+2" '</span></div></div><div style="font-size: 17px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="font-size: 17px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">But from textmate, the script below activates R.app, but doesn’t execute cmd in R…</span></div><div style="font-size: 17px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="font-size: 17px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Any thought?</span></div><div style="font-size: 17px;" class=""><div class=""><br class=""></div><div class="">This is the script of the TM command I use to send the selection to R.app</div><div class=""><br class=""></div><div class="">#!/usr/bin/env bash</div><div class=""><br class=""></div><div class=""># input is selection or document</div><div class="">rawText="`cat`"</div><div class=""><br class=""></div><div class="">curDir=''</div><div class="">if [[ ${#TM_DIRECTORY} -gt 0 ]]; then</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>curDir="$TM_DIRECTORY"</div><div class="">fi</div><div class=""><br class=""></div><div class="">osascript -e 'on run(theCode)' \</div><div class=""><span class="Apple-tab-span" style="white-space:pre">             </span>  -e 'tell application "R" to activate' \</div><div class=""><span class="Apple-tab-span" style="white-space:pre">          </span>  -e 'if (item 2 of theCode) is not "" then tell application "R" to cmd "setwd('\''" & (item 2 of theCode) & "'\'')"' \</div><div class=""><span class="Apple-tab-span" style="white-space:pre">              </span>  -e 'tell application "R" to cmd (item 1 of theCode)' \</div><div class=""><span class="Apple-tab-span" style="white-space:pre">           </span>  -e 'end run' -- "$rawText" "$curDir"</div></div><div class=""><br class=""></div></body></html>