On 2/26/08 at 1:48 AM, Aaron Hsu <[EMAIL PROTECTED]> wrote:
> Well, basically, think of it like this. Here is how a typical workflow
> of mine goes right now:
>
> 1) Start the Scheme Interpreter by invoking it on a command-line:
>
> $ scheme
> …
> >
>
> 2) Open BBEdit with a Scheme file that I am editing.
> 3) I then “set-up” my Scheme environment by selecting all my Scheme
> code and dragging it into the Terminal window. This has the effect of
> evaluating all the code from this file in that window.
> 4) I think run a few tests, and when I make a change to the file, say,
> modify the definition of a procedure, then I just highlight the
> procedure, and then copy and paste it into the terminal window. Doing
> this has the effect of re-evaluating that code and I get the procedure
> redefined.
>
> My question is: how can I do this without having to do all the copy
> and pasting. I'd like to have something like a command where I could
> do “Send file to Scheme” or ”Send selection to Scheme.”
>
> Any ideas? Worksheets are nice in that I can do everything from within
> my editor, but…I still want a way that I can send my text to the
> environment without having to copy and paste between windows. I am
> unsure of how Unix Filters would help this case, but I would be
> interested in seeing an example.
>
> Thanks for your help,
>
I think two scripts will solve most of your problems....
Place these in ~/Library/Application Support/BBEdit/Scripts/
You can then run them via the Scripts Palette or set a keyboard command for
them.
Script 1:
(* execute the contents of the current BBEdit window in Terminal *)
on run
set scrpt to ""
tell application "BBEdit"
set scrpt to contents of text window 1
end tell
if scrpt is not "" then
tell application "Terminal"
activate
do script scrpt in window 1
end tell
end if
end run
Script 2:
(* execute the contents of the current select in the current BBEdit window in
Terminal *)
on run
set scrpt to ""
tell application "BBEdit"
set scrpt to contents of selection of text window 1
end tell
if scrpt is not "" then
tell application "Terminal"
activate
do script scrpt in window 1
end tell
end if
end run
Alternative Script 1 (if you're using iTerm):
(* execute the contents of the current BBEdit window in iTerm *)
on run
set scrpt to ""
tell application "BBEdit"
set scrpt to contents of text window 1
end tell
if scrpt is not "" then
tell application "iTerm"
activate
tell current session of current terminal
write text scrpt
end tell
end tell
end if
end run
You'll notice that I left error checking up to you. These assueme that there is
an open window in both BBEdit and Terminal/iTerm. You could check to see if
that was true and then bail or open a window it it is missing.
-Gregory
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>