On 21/11/2012 17:18, Jean-Baptiste wrote:

When running a text factory, the open document is being modified.

Is there a way to have the results sent to the scratchpad and leave the document untouched?

I would like to keep the original document unmodified.
Here’s how I would do it in the case of a text filter. I’m not sure why the scratchpad doesn’t understand regular new line characters but the problem is overcome by the use of "\r". For the case of a new document you would simply change the path and then do a system call to open it in BBEdit : system ("open -a bbedit '$scratchpad'");

#! /usr/bin/perl
use strict;
my @lines;
my $scratchpad =
 "$ENV{HOME}/Library/Application Support/BBEdit/Scratchpad";
while (<>) {
  print; # leave things as they are
  # make modifications here
  push @lines, $_; # add the modified line to the array @lines
}
open FH, ">>", $scratchpad or die $!;
print FH "\r_______________\r\r";
for (@lines){ # write each line to the scratchpad
  print FH "$_\r";
}
print FH "_______________\r";
close FH;
#        system ("open -a bbedit '$scratchpad'");

# JD

--
--
You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups.
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 feature request or would like to report a problem, please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to