On Dec 13, 5:09 am, Maarten Sneep <[email protected]> wrote: > On 13 dec 2008, at 03:35, gshenaut wrote: > > > I notice that there is a plethora of different ways to filter text > > through a pipeline, but I can't find anything that corresponds to the > > venerable vi "!" commands: specify some text, hit "!", type in a > > pipeline, the selected text is written to the standard input of the > > pipeline and the standard output of the pipeline replaces the text. > > > I tried making a filter like this (pardon my rudimentary applescript > > abilities): > > This won't work. BBEdit will not process AppleEvents while it is busy > running a shell filter. > > > I remember reading that you're not supposed to do "fancy GUI stuff" > > from those filters, and I'm guessing that putting up a display dialog > > is too fancy. > > That is not the problem, the tell application "BBEdit" part is causing > the trouble.
Ah, OK, I understand that at least. I did try telling other applications and the result was confusing and not useful. > > Is there some way to filter text through an ad hoc shell pipeline? It > > would really be convenient. > > Do it all in AppleScript. But wouldn't you still have to do a "tell app \"bbedit\"" or the equivalent even if it was all applescript? (As I said, I'm at a loss in applescript.) And I also don't know how in applescript to feed the selected text into the shell command's standard input and then to replace the selection with the command's standard output. 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. (5) The selected region is replaced with the command's standard output. (6) If there was an error, an alert pops up with the command's standard error output. This is pretty much identical to vi's shell filter command. I was hoping it to be built into BBedit, but I guess it isn't, so I wanted to make a script to do it, but that turns out to be nontrivial. Cheers, Greg Shenaut --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
