In Hyperlink helper command "Lookup Word / Selection on Wikipedia and link" is broken
Error is
/Users/tim/Library/Application Support/TextMate/Ruby/1.8.7/lib/ruby/1.8/open-uri.rb:174:in `open_loop': redirection forbidden: http://en.wikipedia.org/w/api.php?format=xml&action=opensearch&search=Mende… -> https://en.wikipedia.org/w/api.php?format=xml&action=opensearch&search=Mend… (RuntimeError)
from /Users/tim/Library/Application Support/TextMate/Ruby/1.8.7/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
from /Users/tim/Library/Application Support/TextMate/Ruby/1.8.7/lib/ruby/1.8/open-uri.rb:518:in `open'
from /Users/tim/Library/Application Support/TextMate/Ruby/1.8.7/lib/ruby/1.8/open-uri.rb:30:in `open'
from Lookup Selection on Wikipedia and link:19:in `getWikiEntries'
from Lookup Selection on Wikipedia and link:31:in `getWikiDef'
from Lookup Selection on Wikipedia and link:37
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"