At 09:54 -0800 13/12/08, gshenaut wrote:
>I was hoping for an easy solution to this very basic and obvious
>utility, but I guess there isn't one. Let me describe what I want to
>do one more time, and then I'll move on.
>
>(1) Select some text in BBedit
>(2) Run the ad-hoc shell pipeline utility.
>(3) A dialog comes up allowing you to type in a command using the
>syntax of your default shell (e.g., bash, ksh, tcsh).
>(4) The command you typed in is run by your shell with the selected
>text as its standard input...
Here's a little demonstration that probably doesn't do quite what you
want but which shows how it can be done. To run Applescript
(osascript) from the shell is to do things inefficiently from back to
front.
property _linefeed : ASCII character 10
set _tmpdir to "/tmp/" as POSIX file
set _filename to "temp.pl"
set _temppath to ("" as Unicode text) & _tmpdir & _filename
set _tempFile to file _temppath
set _dd to display dialog "
Replace selected asterisks in new doc with..." default answer ""
set _q to text returned of _dd
try
close access _tempFile
end try
open for access _tempFile with write permission
set eof _tempFile to 0
set _lines to paragraphs of _FILTER(_q)
repeat with _line in _lines
write _line & _linefeed to _tempFile as «class utf8»
end repeat
close access _tempFile
tell application "BBEdit"
activate
set _doc to make window
delay 1 -- for demo only
set text of _doc to "****************"
delay 1 -- for demo only
select characters 5 through 12 in the _doc
delay 1 -- for demo only
run unix filter _tempFile
delay 1
close the _doc without saving
end tell
on _FILTER(_q)
"#/usr/bin/perl
$q = qq~" & _q & "~;
while (<>) {
s~\\*~$q~g;
print;
}"
end _filter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or
confirmed) problem with the software, please email to "[email protected]"
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---