Stata/R Applescript with BBEdit 10

218 views
Skip to first unread message

Christopher

unread,
Jul 21, 2011, 9:15:28 PM7/21/11
to BBEdit Talk
I just upgraded to BBEdit 10.0 and immediately had problems using
Applescript to send commands to Stata and R. The error message I get
is

Finder got and error: Can't get container of file . . .

The Stata Applescript I'm using is from: http://sites.google.com/site/josefmontag/programs

This is an entirely new problem that showed up after the update. Any
help would be much appreciated.

Steve Samuels

unread,
Jul 22, 2011, 9:41:26 AM7/22/11
to BBEdit Talk
This is the problem that I reported at
http://groups.google.com/group/bbedit/browse_thread/thread/2492bef49ed7cdcc#

I just simplified to show the issue for people who don't use the Stata/
R script.

Steve Samuels

unread,
Jul 22, 2011, 1:59:30 PM7/22/11
to BBEdit Talk

Scripts to: 1) send a file to R or Stata and 2) send a selection to
Stata in BBEdit 10 are now at:
http://www.mediafire.com/?ndchk0imd9u9o

Consider the following script.
------------------------
tell application "BBEdit"
set x to file of text document 1
x
end tell
-------------------------
In BBEdit 9, it will return an object of type "alias"
In 10 it returns an object of type "file". ("type" might be the wrong
term). In the scripts I changed the set statement to the equivalent
of:

set x to file of text document 1 as alias


Steve

Christopher

unread,
Jul 22, 2011, 11:12:58 PM7/22/11
to BBEdit Talk
Thanks Steve for your help.

The send to R and Stata applescript works fine now, but I still have
the same problem with the Send a Selection to stata (even in the
updated file).

Sorry, I'm not a huge Applescript user, so an help would be much
appreciated.

Steve Samuels

unread,
Jul 23, 2011, 11:48:38 AM7/23/11
to BBEdit Talk
Sorry, that was the wrong version. I'll upload again when I get a
chance. In the meantime, open the script up in AppleScript Editor and
add "as alias" to the line that begins "set the OriginalFile". Hit
the compile button. While the script is still open, select some text
in your do file and hit the run button. When you are sure the script
is working, close it and you should be good to go.

I should also add that the original send do-file to Stata and send
selection to Stata scripts were written by Ben Hulley.

Christopher

unread,
Jul 24, 2011, 1:32:25 AM7/24/11
to BBEdit Talk
Thanks Steve. It now works fine. I've also updated the SendToR_sel
script so that it works with 10.0. I can send it to you so you can
post it with the others if you'ld like.

Christopher

unread,
Jul 24, 2011, 7:07:40 AM7/24/11
to BBEdit Talk
Thanks again Steve, it works now.

I've also updated the RSelector script, maybe I can send it to you and
you can post them all together?
Message has been deleted

Steve Samuels

unread,
Jul 24, 2011, 9:02:20 AM7/24/11
to BBEdit Talk
Great! Thanks! Please send it privately and include your full name.
If you are talking about the "DoSelectionRorStata" script, you should
also send it to Josef. I'll send the new versions to John Gardner at
DataNinja. Make sure your script still works in BBEdit 9.
Reply all
Reply to author
Forward
0 new messages