Re: Easiest way to replace all matches

2021-10-25 Thread John Delacour


On 21 Oct 2021, at 12:47, TJ Luoma mailto:luo...@gmail.com>> 
wrote:

> I'd like to be able to select a word, press a key, and have all instances of 
> that word be surrounded by {brackets} I wondered if there was a more 
> native way to accomplish this

#!/usr/bin/perl
while (<>) {
s~myword~{$&}~ig;
print;
} #END

The script
• reads the document line by line,
• surrounds all (~g) occurrences of "myword" (case-insensitive ~i) with curly 
brackets,
• prints the line.

Instructions:

Save the script in the Text Filters folder as ***.pl 
( Terminal:— cd; open Library/Application\ Support/BBedit/Text* )
Open the palette:  Menu: Window::Palettes::Text Filters
Select the script and set an optional keyboard shortcut
With your document frontmost, run the script
You can undo the action of the UNIX filter but…
… to see the result without altering the doc, run the script from the Scripts 
folder+palette

JD


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/99376642-B69E-4477-8090-519AC6668FCE%40gmail.com.


Re: AppleScript -1728 error with replace selection

2021-10-24 Thread John Delacour


On 24 Oct 2021, at 05:55, Sonic Purity  wrote:

>  ...i have a Big Picture question about whether perhaps my entire approach is 
> off base.

It is.  There are several languages that are good for text editing, and 
AppleScript is not among them. The conciseness of your desiderata below should 
be matched in your script.

> I want to preserve whatever markup exists as it is, to the right of my 
> delimiter #BARRIER#. To the left, in the actual title="", each  should 
> be replaced with * and each  with **, and any other tags should be 
> removed.

 
BBEdit’s regular expressions are not much different from Perl’s, on which they 
are based.  Here is a simple Perl script that will do what you demand:

#!/usr/bin/perl
#Save in ../Text Filters/; run from palette
while (<>) { #read line by line
my ($left, $right) = split "#BARRIER";
$left =~ s~~\*~g; # s~x~y~g means substitute y for x globally
$left =~ s~~\*\*~g;
$right =~ s~<[^>]+?>~~g;
print $left . $right;
}
#END

With your document frontmost, try running the script above from the Text 
Filters palette after saving it as ***.pl in the proper folder; to open this 
run this line in Terminal:

cd; open Library/Application\ Support/BBedit/Text*

Have fun !

JD



-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A825AFDC-6333-4D04-A4C2-47912B2E3EB4%40gmail.com.


Re: Grep Pattern Needed

2021-09-29 Thread John Delacour


On 28 Sep 2021, at 19:04, Kim Mosley  wrote:

> I'm looking for a grep pattern to put this data into 5 columns (though there 
> is no data for the "tags" column). Hopefully I can paste it into Excel. Now 
> it just goes into one column.

Save this script as xx.pl in
"~/Library/Application Support/BBEdit/Text Filters/",
bring your document to the front and run the filter from the palette (Menu: 
Window::Palettes::Text Filters.)

If you want to see the output without modifying the file, run the same script 
from the Scripts palette after saving it in the .../BBEdit/Scripts folder; 
otherwise just undo the work of the filter.


#!/usr/bin/perl
my $counter = 0; my $max = 5;
while (<>) { #read rows in succession
$counter++;
chomp; #remove linefeed
print "\t" if $counter == 4 && $max == 4; #skip a column
print; #add contents to column
if ($counter < $max) {
print "\t";
} else { #start a new row
print $/;
$counter = 0;
$max = 4; #allow for the missing tags data
}
}
#END

Let us know if there's any problem.

JD


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A1E07F6D-53F4-4581-B0EA-875478FDB47A%40gmail.com.


Re: GREP pattern to replace the first element with a tab

2021-03-25 Thread John Delacour


On 21 Mar 2021, at 08:39, samar  wrote:

> The reason you cannot reproduce the error with your file may be that the 
> second column is limited to three different texts (B1, B2, and B3) whereas in 
> mine there are more (up to B7 here, but the script should also work with more 
> than seven):

The script works with all files that have tab-delimited values, whatever those 
values may be.  Your supposition is quite unfounded; the logic of the script is 
quite clear.

> A1B1
> A1B2
> A1B3
> A1B4
> A1B5
...

but if you separate the values with spaces, as you have done here, then the 
file does not meet your own criteria.  As Christopher has remarked, while 
asking you to send your file, the script works with all valid files, and does 
the work not in eight seconds (!!) but in the twinkling of an eye.

If anybody can point out a real flaw in my script, I shall be happy to correct 
it.  If you will send me your file, I shall be glad to explain why you are 
having the problem.

JD




-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B4793D64-D656-4A5C-A557-2BACED29814C%40gmail.com.


Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread John Delacour


On 20 Mar 2021, at 16:33, samar mailto:arnet...@bluewin.ch>> wrote:

> ...when I run the text filter, not all occurrences of the first element get 
> replaced when necessary:
> 
> 
> 
> Here a tab should also replace A1 in line 5, A2 in line 12, and A3 in line 18.

That makes no sense to me.  If the current col1 is identical to col1 of the 
previous line, then the value will not be printed; that is the clear logic of 
the routine.  I cannot reproduce your error.


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/65002B2A-D433-44C3-A303-1E84D8A91EE9%40gmail.com.


Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread John Delacour


On 20 Mar 2021, at 11:30, samar  wrote:

> I'm looking for something which I assume is pretty easy to accomplish with 
> GREP but I fail to see how.
> 
> I have a large text file with entries sorted in this way:
> 
> ...That is, the first element is replaced by a tab character *if* the first 
> element is a repetition of the first element of the previous line(s). The 
> sort order remains unchanged.

Create a text filter "~/Library/Application Support/BBEdit/Text 
Filters/SAMAR.pl" and run it from the Text Filters palette (opened from Window 
menu).  The script will affect the whole file, or just the selection if one is 
made:


#! /usr/bin/perl
my $a;
while (<>) {
my ($col1, $col2) = split "\t", $_;
if ($col1 eq $a) {
print "\t$col2"
} else {
print "$col1\t$col2";
$a = $col1;
}
}

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/4EE3BAFE-E482-4CDD-A428-EAF083608F4A%40gmail.com.


Re: Need some help with multiple search-replace Apple script

2020-10-15 Thread John Delacour


On 13 Oct 2020, at 06:54, Mathias af Jochnick  wrote:

> i'm trying to make 2 scripts to convert between IOS and Android i18n formats 
> to work. I've gotten Android -> IOS to work, but the other way around is a 
> challenge.
> 
> Basically, for each row in a file i want to convert
> "login_infoLabel" = "Do you need help? Press here.”;
> to
> Do you need help? Press here. 
> See my script below. The problem is the first search string to find the first 
> " on each row. I spoke with Patrik at BBEdit and he kindly informed me that 
> it was because AppleScript doesn't support grep

Patrick could not be more right!  AppleScript is not the tool for text; but 
BBEdit provides the Text Factory feature that allows you to use Perl (or 
Python, or sed) to do the work easily.

Here is your script written in Perl:

#! /usr/bin/perl
while (<>) {
# changes quotes round string name to §, preserving them
s~"(login_infoLabel)" ?= ?([^;]+);~$2~g;
# delete the quotes not preserved
s~"~~g;
# restore the quotes round string name
s~§~"~g;
# remove the final semicolon
s~;$~~;
# Execute the substitutions
print;
}

This script will operate on the front window.

How to do it—
1. Open a new Text Factory (Menu: File::New...), paste in the above script, and 
save it as test.pl in
~/Library/Application Support/BBEdit/Text Filters/
2. Open the (Menu: Window::Palettes::)Text Filters palette
3. Set a shortcut of you like
4. Run the script (filter) with your target window frontmost.

Notes—
I use "~" in the regex rather than "/".  You can use whatever you like.
s~found~replacement~g ;  #~g means replace all
Perl Regular Expressions differ from BBEdit's PRE in using $1, $2 etc rather 
than \1, \2
All the Perl knowledge you need to make the filter is:
a valid shebang line (should not be necessary and was not in better 
days!);
the while loop: while (<>) { ..  } ;
a knowledge of regex in Perl, which is almost the same as BBEdit's 
implementation but more powerful.

JD





-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/74972111-C82C-41EF-9492-C3698E0B5301%40gmail.com.


Re: AppleScript question

2020-10-12 Thread John Delacour


On 12 Oct 2020, at 15:13, Greg Raven  wrote:

> This looks slick, but it doesn't run for me. I get an error on save, and the 
> (path to desktop as string) seems not to resolve to anything.

That’s very odd!  I am running MacOS 10.13.6.  Hard to imagine they have made  
that go away; but try instead

path to desktop as Unicode text


If that doesn’t work, goodness knows!

Obviously you will get an error on save if you have no path.

JD


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/C604DCB4-1F5F-4C7C-B4B9-BE55094E1E3F%40gmail.com.


Re: Extracting parts of names from full names

2020-02-28 Thread John Delacour


> On 28 Feb 2020, at 16:00, I wrote:
> 
> Replace all with \1 \2

…or Extract, of course!

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/EC3902E9-B866-4BBB-B5E6-C9B69807B0FB%40gmail.com.


Re: Extracting parts of names from full names

2020-02-28 Thread John Delacour


On 27 Feb 2020, at 21:43, 'anotherhoward' via BBEdit Talk 
 wrote:

> I have a list of names in this format:
> 
> B.J. Surhoff\surhob.01
> Bobby Bonilla\bonilbo01
> 
> I want to extract the last names and separately extract what comes before 
> each last name 
> (which could be just the first name or two initials as in "B.J.") so that I 
> can later organize them this way:
> 
> B.J. Surhoff
> Bobby Bobby
> 
> I do not need the data after the slash.
> 
> How can I use GREF (REGEX) to extract the last names and separately the 
> first/middle values?

If you don’t need to script it,

search for: (.+?) ([^ ]+?)\\.+
Replace all with \1 \2



JD

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/71966DF5-1088-4F3F-83A1-28E446AAE77F%40gmail.com.


Re: AppleScript example request: BBEdit roundtrip - Shell script via AppleScript

2020-01-20 Thread John Delacour
On Mon, 20 Jan 2020 at 17:01, 'Iain Houston' via BBEdit Talk
 wrote:

> I feel sure that this is a fairly common roundtrip pattern: BBEdit -> 
> AppleScript -> Shell script -> AppleScript -> BBEdit.

Here's an example.  You can also send arguments to an existing shell
script rather than have the script inline:

try
   set _q to display dialog "What is your name" default answer ""
   set _a to text returned of _q
end try

set _perloutput to do shell script "
perl <<'END'
my $name = qq~" & _a & "~;
print qq~Your name is $name~;
END"
display dialog _perloutput

--JD

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CAH37uVpGAQWLxZmbE%3DWc-aTMfrPeWtM3diTJ-bXKsK16wpefNg%40mail.gmail.com.


Re: How to Force BBEdit to Display CP437 High ASCII

2015-04-09 Thread John Delacour

On 9 Apr 2015, at 09:56, WordWeaver777 wordweaver...@gmail.com wrote:

 Despite trying a mixture of the above encodings and fonts, I haven't been 
 able to get the CP437 characters to display properly in a BBEdit text file.

Open the file normally; then do menu: File::Reopen Using Encoding… and select 
Windows (Latin 1). You can then change the encoding to UTF-8 and save.

JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Command Line Create New BBEdit Document Paste

2014-12-15 Thread John Delacour

On 15 Dec 2014, at 18:05, Rich F li...@viaduct-productions.com wrote:

 I’d like to have BBEdit receive text that I have parked in a Ruby variable 
 coming out of open-uri.  Is there a way to create a new document that’s 
 unsaved, then copy that variable to that document?  I’m assuming I’ll use the 
 bbedit command line interface for this, but I can’t seem to find any way of 
 targeting a new document.  Scratchpad might be an option, but it’s not 
 elegant.

Smething like this?:

echo some_text  x.txt; open -a bbedit x.txt

JD



-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: How to concatenate/merge/combine text files with BBEdit (version 10.5.11)

2014-07-10 Thread John Delacour

On 10 Jul 2014, at 00:56, Jason Finley jasonrichardfin...@gmail.com wrote:

 How to concatenate/merge/combine text files into one text file:
 --Create a new blank document.
 --Edit -- Insert -- File Contents...
 --Select ALL the files you want to concatenate/merge/combine together.
 --Save the new document.

This can be done very simply in the Terminal or using an AppleScript script to 
identify the documents you want to concatenate and then using do shell script 
cat...


cd some_folder;
cat a.txt b.txt c.txt  all.txt;
open -a bbedit all.txt


JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Text Filter that does nothing makes document dirty?

2014-01-29 Thread John Delacour

On 26 Jan 2014, at 00:59, Tim Hill drtimh...@gmail.com wrote:

 Just finished a text filter (in Lua) that cleans up source files for me 
 (mostly comment formatting). Works great :)
 
 However, if the filter does nothing (that is, the output text is the same as 
 the input text), BBEdit always marks the document as dirty, even though 
 nothing has changed. While this is ok, it would be nice to avoid this (as it 
 also indicates to the user if the filter did anything or not).

I don't think there is any way of avoiding this with a text filter.

What you could do is get and set the text using AppleScript and make your 
modifications to it using your chosen scripting language--Perl in this example: 


tell application BBEdit to tell the front document
  set _text to its text
  set _new_text to do shell script perl END;
  while (DATA) {
# make modifications
print;
  };
__DATA__
  _text  return  
END
 -- *
  if _text is not _new_text then
set its text to _new_text
  else
beep
  end if
end tell


-- * check whether the final return is necessary!


JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: STDOUT or STDIN?

2014-01-07 Thread John Delacour

On 4 Jan 2014, at 09:33, Christopher Stone listmeis...@suddenlink.net wrote:

 In a Text Filter can you grab STDIN do stuff and prevent STDOUT from 
 rewriting the front document?
 
 Alternatively is there a way to pipe the selection or whole text from the 
 front document in a Unix Script (not a Text Filter) without having to save 
 the front document first?
 
 (I can always use Applescript, but at the moment I'm trying not to.)


If you run this text filter on the front document, whether saved or not, the 
document will be rewritten just as it is, and you can write your modified 
output, whatever it is, to another document.  This also shows what extra 
variables are available in this environment. If this isn't the sort of thing 
you want, let us know more clearly what you want to do.

You also have various run options in the shebang menu.


#!/usr/bin/perl
my $tempfile = /tmp/temp.txt;
my $fh;
open $fh, $tempfile;
while(){
print;
print $fh $_;
}
print $fh \n\n\%ENV:\n;
foreach (keys %ENV) {
print $fh $_: $ENV{$_}\r if /^BB/;
}
`open -a bbedit '$tempfile'`


#JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Print without folded text

2013-12-17 Thread John Delacour

On 17 Dec 2013, at 03:55, Lawrence San lawrence...@gmail.com wrote:

 ...I'm using BBEdit 9.6.3 with OS X 10.6.8 (Snow Leopard). Your mention of 
 soft-wrapped confuses me a little; are you saying that hard-wrapping is a 
 precondition for suppressing the printing of folded text, in BBEdit 10?…

Sorry, I understood you to mean wrapped text and not folded elements.  So far 
as I can see it is not possible to print just what you see when elements are 
folded in the display; these will always be expanded on printing.

I suppose it would be possible to use the startDisplayLine and endDisplayLine 
properties of each line to write a script to produce a document containing only 
the displayed lines, and print that.  Here’s a very basic script to show the 
sort of thing I mean.  It could be elaborated to print something very similar 
to what you actually see.

tell application BBEdit
  tell document 1
set _docid to its ID
set _n to count lines
set _displayed to {}
repeat with _i from 1 to _n
  set _shown to endDisplayLine of line _i
  if _shown is not in _displayed then
set end of _displayed to _shown
  end if
end repeat
_displayed -- a list of displayed lines
  end tell
  set _text to 
  repeat with _i in _displayed
set _text to _text  line _i of document id _docid  return
  end repeat
end tell

--JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


How to prevent search term osmosis?

2013-11-29 Thread John Delacour

I am experiencing a very annoying new “feature” with the latest system software 
and the latest BBEdit beta : if I type a search term/pattern in a browser and 
then return to BBEdit, I find this pattern has been replaced in the BBEdit Find 
dialogue; and vice versa. This is especially annoying when I have a complicated 
regular expression set up in BBEdit; not only do I lose the pattern but I also 
lose the grep option setting.

How do I disable this latest stupidity—which I presume is some Apple nonsense?

JD


-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: How to prevent search term osmosis?

2013-11-29 Thread John Delacour

On 29 Nov 2013, at 16:33, Rich Siegel sie...@barebones.com wrote:

 This has been an intrinsic behavior of the OS since OS X 10.0, back in March 
 2001. It isn't exactly new. Corollary: failure to take prior notice doesn't 
 constitute recent onset. :-)

Ya, but I really don’t think I have been that sleepy in recent years!

 Search for find scrap in BBEdit's Expert Preferences help for a helpful 
 hint.

16:50:30 User:jd   Cwd: ~
➔ defaults read com.barebones.bbedit FindDialog_UsesFindScrap
2013-11-29 16:50:36.993 defaults[23781:507] 
The domain/default pair of (/Users/jd/Library/Preferences/com.barebones.bbedit, 
FindDialog_UsesFindScrap) does not exist

Any more hints?

JD



-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: How to prevent search term osmosis?

2013-11-29 Thread John Delacour

On 29 Nov 2013, at 17:06, Rich Siegel sie...@barebones.com wrote:

 Yes: follow the directions in the help.

OK.  So the default is YES/1, but there is no default until I set it.  Got it.  
Great metaphysics!

JD


-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Grep or

2013-11-01 Thread John Delacour

On 25 Oct 2013, at 12:11, perdox perryk...@gmail.com wrote:

 ...I would like to find, in one Search and replace ALL of the space 
 id=,space rid= bits and add a prefix that is to be the number used in 
 the file name. So for example, I would end up with
 
 list id=P35-L1
 list id=P35-L2
 ref id=P35-R008”

You can easily do this with a text filter.  Here’s one using Perl:

#!/usr/bin/perl
my $f = $ENV{BB_DOC_NAME}; # get the name of the front doc
# code to extract the number from the file name
(my $n = $f) =~ s~([^\d]+)~~g; # remove all non-digits
while(){
s~ref id=~$$n-~g;
s~list id=~$$n-~g;
s~ref-type=~$$n-~g;
s~rid=~$$n-~g;
print;
}

# JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Put selection into Quick Find

2013-08-20 Thread John Delacour

On 19/8/13 at 01:22, lawrence...@gmail.com (Lawrence San) wrote:


I tried to make the process more efficient by simply adding paste
like this:



set live search bar visible to true
paste



...but it didn't work; I still need to command-v. Why is that?


I tried that too, and you’d think it _should_ work, because 
the focus is in the search field and the selection is grayed 
out, but in fact ‘paste’ simply pastes instead into the 
selection in the document.  This means that ‘selection’ and  
‘paste’ in the Apple event context ignore the search field 
and consider only the text of the document itself.  Something of 
an anomaly, I’d say.  Moreover if you select the text in the 
search field and ‘tell app “BBEdit” to get the 
selection’, you get an error, whether or not text is selected 
in the document.


[ Bcc to supp...@barebones.com ]

JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Put selection into Quick Find

2013-08-19 Thread John Delacour

On 19/8/13 at 20:50, lawrence...@gmail.com (Lawrence San) wrote:


I often use Quick Find in BBEdit 9.6.3. I'd like to be able to use a
keystroke to transfer whatever text I've selected in my document (usually a
single word) into the Quick Find dialog, but I can't find one...


If you run this script (which can be assigned a key-stroke), it 
will put the selected text on the clipboard and highlight any 
text in the live search box.  You then need only type ⌘V to 
enter the text.


tell application BBEdit
  activate
  tell front text window
set the clipboard to (get selection as string)
if live search bar visible is true then
  set live search bar visible to false
end if
set live search bar visible to true
  end tell
end tell

JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Sorting files names in a project collection?

2013-08-14 Thread John Delacour
On 13/8/13 at 18:39, fschietteca...@gmail.com (François 
Schiettecatte) wrote:



I want to sort the files in a project Collection, is there a way to do
that automatically or do I need to do it the old fashioned way ?


*How* do you want to sort them?

I usually want to sort them according to which of them I am 
currently working on and find it very easy to drag them to 
convenient positions in the list as I proceed or hide them in folders.


JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Resizeable 'Currently Open Documents' frame

2013-08-12 Thread John Delacour

On 9/8/13 at 12:25, j...@kilroyjames.co.uk wrote:

Well I am sick of not being able to see at a glance what files 
I've got open...


Did you read my reply to your last rant on this topic? :


== Forwarded Message ==
Date: 12/7/13 21:54
Received: 12/7/13 21:54 +0100
From: j...@bd8.com (John Delacour)
To: bbedit@googlegroups.com

On 12/7/13 at 09:34, j...@kilroyjames.co.uk wrote:

People have been asking for the Currently Open Documents window 
to be resizeable for about two years...


Are you aware of the Windows palette 
(Menu—Window::Palettes::Windows)?  Each open project listed in 
this resizable palette has a collapsible list of the project’s 
currently open documents in a font size much smaller than the 
list in the project sidebar.  Perhaps you would find this even 
more convenient than what you are hankering after.


JD


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Speech in BBEDit

2013-08-01 Thread John Delacour
On 1/8/13 at 20:20, maarten.sn...@xs4all.nl (Maarten Sneep) wrote:

 -- Not poorly documented: just AppleScript.
 on run
   tell application BBEdit
   set my_sel to (selection of text of text document 1) as text
   end tell
   say my_sel
 end run

Or, more simply:

tell application BBEdit to say   selection
-- selected text only

tell application BBEdit to say (get text in front document)
-- whole text

JD

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Searching for files of a particular line break type

2013-07-30 Thread John Delacour

On 29/7/13 at 03:27, b...@cruzio.com (Bruce Van Allen) wrote:


Substituting in for John's one-liner, but NOT reducing blank lines:

perl -pi.bak -e s~\015?\012|\015~\n~g


Yes, sorry—I should have been in bed when I posted that!

JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Searching for files of a particular line break type

2013-07-29 Thread John Delacour

On 28/7/13 at 22:53, st...@shodgson.org.uk (Steve Hodgson) wrote:

Given a folder of text files is it possible to search which one 
are of a particular line break type - say Mac Classic (CR)?


If your directory is “~/temp/textfiles/”, run this script in 
Terminal to change carriage return to linefeed in all the files 
it contains:


cd; cd temp/textfiles; perl -pi.bak -e s~\r~\n~g *

The script will create a backup of the original.

JD


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Searching for files of a particular line break type

2013-07-29 Thread John Delacour
On 29/7/13 at 21:06, rar...@banet.net (Robert A. Rosenberg) wrote:

 One warning. If you want to change CR to LF (as in this suggestion),
 you have to watch out for the CR+LF Line ending since just changing CR
 to LF will make this LF+LF.

This will change _any_ line ending to \n :

perl -pi.bak -e s~[\r\n]+~\n~g *


JD


-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Currently Open Documents

2013-07-12 Thread John Delacour

On 12/7/13 at 09:34, j...@kilroyjames.co.uk wrote:

People have been asking for the Currently Open Documents window 
to be resizeable for about two years...


Are you aware of the Windows palette 
(Menu—Window::Palettes::Windows)?  Each open project listed in 
this resizable palette has a collapsible list of the project’s 
currently open documents in a font size much smaller than the 
list in the project sidebar.  Perhaps you would find this even 
more convenient than what you are hankering after.


JD




--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Epubs, html, and smart quotes

2013-07-09 Thread John Delacour

On 9/7/13 at 16:51, joncli...@gmail.com (Jon) wrote:

I'm editing an epub with the current release of BBEdit. I'd 
like to educate all of the quotes in the text, but I don't want 
to educate all of the quotes in the accompanying HTML. Any 
solutions? Thanks.


Here’s a text filter I wrote a long while ago and which I 
presume does the job.


First smarten all quotes and then run the filter.  You can undo 
the action of a filter in one go if you need to.



#!/usr/bin/perl
while() {
  undef $line;
  @chars = split //;
  for (@chars) {
// and undef $change;
// and  $change = 1;
if ($change) {
  s~[“”]~~;
  s~[‘’]~'~;
}
$line .= $_;
  }
  $_ = $line;
  s~~~g;
  s~'~'~g;
  print
}

# JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: need to replace time value in different lines

2013-06-18 Thread John Delacour

 
On 18/6/13 at 19:44, kaa...@rgb.ee (Kaarle Kannelmäe) wrote:


i have a problem i cannot solve myself..
i'm using Textwrangler and i need put new time values:


You have 20 lines and only 18 replacements, so your last two 
lines will be unchanged if you use the following text filter.  
You can find out in the manual where to put text filters and how 
to use them.



#!/usr/bin/perl
use strict;
my @new_times = split /[\n\r]+/,
00:00
00:16
00:42
04:01
05:27
07:51
08:59
11:37
12:52
14:23
15:06
16:32
17:17
17:37
18:09
18:32
18:39
19:03;
my $i = 0;
while (){
  s/[0-9][0-9]:[0-9][0-9]/$new_times[$i]/ if $new_times[$i];
  print;
  $i++;
}

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: New Text Document… for project, keyboard shortcut?

2013-05-24 Thread John Delacour

I asked:


A simple AppleScript script with a keyboard shortcut would do it,
but where do you want to save the file——in the .projectd or  
elsewhere?


On 23/5/13 at 16:18, jer...@cowgar.com (Jeremy Cowgar) wrote:


When using the content menu on a given directory, it defaults to the
selected directory. If a keyboard shortcut existed, I would think it
would default to the project directory. If I wanted to place the file
in a sub-directory of the project, I could navigate there.


The reason I asked is that a .projectd file can take files or 
folders from anywhere.  If all your files are in the same 
directory as the .projectd file then you can save this script in 
your Scripts folder and assign a keyboard shortcut to it.  This, 
I think, will do what you want.  If you want files, folders or 
URIs from elsewhere added then the script can be modified accordingly.


tell application BBEdit to tell the front project document
  set _pd1 to its file
  set AppleScript's text item delimiters to :
  set _folder to POSIX path of ¬
(  text items 1 through -3 of (_pd1 as string))
  tell me to set _dd to ¬
display dialog Name your file: default answer filename.txt
  set _filename to (text returned of _dd)
  set _posix_path to _folder  /  _filename
  do shell script   quoted form of _posix_path
  make new project item with properties {file:POSIX file _posix_path}
end tell

-- JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: New Text Document… for project, keyboard shortcut?

2013-05-23 Thread John Delacour

On 23/5/13 at 11:44, jer...@cowgar.com (Jeremy Cowgar) wrote:


Is there a keyboard shortcut for the context menu item New Text
Document... ?


A simple AppleScript script with a keyboard shortcut would do 
it, but where do you want to save the file——in the .projectd 
or elsewhere?


JD


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: grep search and replace help

2013-05-20 Thread John Delacour

On 20/5/13 at 11:53, dom.obr...@gmail.com (Dom O'Brien) wrote:


1,4

I want to add a _ to the first number (1_) and repeat to 
the value of the next number. so 1,4 would end up being


1_1
1_2
1_3
1_4


Here's a Perl text filter that will do it:

#!/usr/bin/perl
while (){
  if (/(\d+),(\d+)/) {
for $i (1..$2) {
  print ${1}_$i\n;
}
  }
}


#JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: 10.5.3 removing extension on Save As and Save a Copy

2013-05-15 Thread John Delacour

On 14/5/13 at 01:29, b...@cruzio.com (Bruce Van Allen) wrote:


[Watch out for email line-breaking -- ...


Mailsmith sends format=flowed, so there is no danger of that.

JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Arbitrary Keybindings in BBEdit

2013-05-13 Thread John Delacour
On 13/5/13 at 21:16, chris.fina...@gmail.com (Christopher 
Finazzo) wrote:


In an ideal scenario, I wouldn't have to use modifier keys 
(Command, Option, etc.) at all in order to invoke the clipping. 
It just seems odd to me that autocomplete is pigeon-holed 
into this relatively limited way of doing things...


I don't think typing control-tab is any more cumbersome than 
typing tab.  Think of the apps (XCode) where you can use just 
tab to autocomplete : what other options do you have for 
assigning key shortcuts in them?  BBEdit is exceptional in 
allowing you to do practically anything with key shortcuts and 
even to customize the standard shortcut keys.  I think you're 
making a mountain out of a molehill.


JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: Dual Panels

2013-05-05 Thread John Delacour

On 3/5/13 at 03:38, adejesus...@gmail.com (a de jesus) wrote:

Is there anyway to have two panels in BBEdit 10 so that my HTML 
file is one panel and CSS file in another panel. With both 
panels in one single window?


No. But the script below will set the two documents side by 
side.  This works on the two windows nearest the front, but you 
can specify certain windows instead if you like.


tell application BBEdit
  -- Place the second window alongside the first, giving it the 
same size

  set {_x1, _y1, _x2, _y2} to the bounds of the first window
  set the bounds of the second window to {_x2, _y1, _x2 + (_x2 
- _x1), _y2}

end tell

Now that drawers are retired you need to use a Project window to 
have more than one file available, but not simultaneously 
visible, in one window.



--JD

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.




Re: I can't change the default font in BBedit 10.5.3

2013-04-30 Thread John Delacour

 
On 30/4/13 at 20:48, diony...@gmail.com (Aethon) wrote:

Anyone else having this problem? It remains stuck on Conselas 
for BBedit 12 but I want to change it.  And after selecting a 
different font, nothing happens.


Are you either clicking the Select button or double-clicking in 
the default font box and then choosing the font in the 
_system_font_palette_ that comes to the front when you do so?  
It works fine in version 10.5.4 (3287).


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quick help with Text Filter

2013-04-29 Thread John Delacour

On 28/4/13 at 01:49, krem...@kreme.com (LuKreme) wrote:

I knew I was going to hate python, and I do. My script was 
failing because there were spaces indenting a line instead of a tab.


I finally, after much struggling, ended up with this:

#!/usr/bin/python ...



Now, one other thing, if I wanted to execute the touch command
(I don't, in this case), could I do that within the python via some
sort of exec() function?


I'm guessing that the Perl you need is _something_like_ the 
script below, which could be made much shorter using a module.


To execute the shell command, just insert
 chomp; `$_`;
after print;


#!/usr/bin/perl
use strict;
while () {
my ($n, $f) = split / /, $_;
my $u_seconds = ($n - 719162) * 86400;
my ($d, $m, $y) = (localtime($u_seconds))[3,4,5];
my $cmd = join ,
(touch -ct ,
$y +=1900,
sprintf(%02d, $m),
sprintf(%02d, $d),
0001);
s/$n/$cmd/;
print;
}

#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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Stationery problems

2013-04-28 Thread John Delacour

 
On page 66 of the newly downloaded manual I read:

To create a stationery pad, click the Save As Stationery checkbox
when saving the file from BBEdit. Alternatively, you can change any
document into a stationery pad in the Finder by clicking the
Stationery Pad checkbox in the document’s Get Info window...c.c

First, the Save As Stationery checkbox seems no longer to exist, 
so I was not able to create stationery that way.  I then saved 
the file without this option in the Stationery folder and did 
the second thing : checked box in the Finder's Get Info window.  
I then hoped to see the template listed under File::New with 
Stationery but it did not appear.  Having today had a problem 
already with Shell Worksheets refusing to work and solving it by 
relaunching BBEdit, I did that, and finally got the new 
Stationery item showing in the menu and opening as expected.


I then read:

• Use BBEdit’s Stationery List, which is available from the
Window menu. The Stationery List is a palette that displays all the
stationery pads you have placed inside the Stationery folder of
BBEdit’s application support folder. You can create a new document
from any of these pads by double-clicking them in this list.

I have scanned the Windows menu and the Windows palette several 
times to make sure my eyes are not deceiving me but I can see no 
sign of this feature.


Can someone please enlighten me.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quick help with Text Filter

2013-04-28 Thread John Delacour

On 28/4/13 at 20:13, krem...@kreme.com (LuKreme) wrote:


I have a file that looks like this:

123456 /path/to/file name/with spaces

with several thousand lines.

I want to run a text-factory that gets the number, runs it
through a bit of python code, and replaces it with the result
without touching the rest of the line. So I would end up with
something like

8578810 /path/to/file name/with spaces...


Use a Text Filter, not a factory.  I don't know Python, but the 
process will be very similar to the Perl routine below. Here I 
have used a subroutine for the math stuff in case it's lengthy:


#!/usr/bin/perl
use strict;
while () {  # read the text line by line
  my $number;
  if (/^\d+/) { # if a string of digits begins the line
my $changed_number = ChangeNumber($); # process the found item
s/$number/$changed_number/; # substitute the calculated replacement
  }
  print ; # replace the line with the modified line
}
sub ChangeNumber {
  return $_[0] * 2; # multiply the first parameter by 2
}

#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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quick help with Text Filter

2013-04-28 Thread John Delacour

On 28/4/13 at 21:32, I wrote:

Use a Text Filter, not a factory.  I don't know Python, but the 
process will be very similar to the Perl routine below...


Well, not really :-/  Here's a simple example of a Python text 
filter, the result of a 5 minute crash course in this weird language:


#!/usr/bin/python
import sys
while 1:
existing_line = sys.stdin.readline()
if not existing_line:
break
replacement_line = *** + existing_line.strip()
print replacement_line

All you need to do is add the regex stuff and the subroutines.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: 10.5.3 removing extension on Save As and Save a Copy

2013-04-24 Thread John Delacour
On 23/4/13 at 20:14, wesleyrh...@gmail.com (Wesley Hall) wrote:

 I'm using 10.5.3 and saving a copy of a file to another location is 
 stripping out the extension of the name.

I can't reproduce this with 10.5.4

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working Directory in Worksheet Script

2013-04-19 Thread John Delacour
On 19/4/13 at 18:51, listmeis...@suddenlink.net (Christopher 
Stone) wrote:


I got tired of typing 'pwd'enterCmd-Z to check the working 
directory of a worksheet, so I wrote a script to add/update it 
as a comment on line one.  It attempts to restore the cursor 
location or selection.


Hello Chris,

I just felt like a bit of useless amusement this evening, so 
here's my variant of your script:


tell application BBEdit
  if class of front document is shell document then
tell front shell window
  activate
  set {_key, _pwd} to {# PWD: , its document's working directory}
  set _selected_text to the selection
  set _insertion_point to characterOffset of _selected_text
  set _text_is_selected to false
  if the length of the _selected_text is not 0 then
set _text_is_selected to true
set _first_char to characterOffset of _selected_text
set _last_char to _first_char + (length of 
_selected_text) - 1

  end if
  set _current_top_line to the contents of the first line
  set _new_top_line to _key  _pwd
  if _current_top_line is  or _current_top_line starts 
with _key then

set the contents of the first line to _new_top_line
  else
set the contents of the first line to _new_top_line  
linefeed  _current_top_line

  end if
  set _increment to (length of _new_top_line) - (length of 
_current_top_line)
  if _text_is_selected then
set _first_char to _first_char + _increment
set _last_char to _last_char + _increment
select (characters _first_char through _last_char)
  else
select insertion point before character 
(_insertion_point + _increment)

  end if
end tell
  end if
end tell

--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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How do I write a Unix filter/script which knows the path to my current document?

2013-04-15 Thread John Delacour

On 14/4/13 at 01:55, john.hor...@gmail.com (jh) wrote:


I'd like to be able to run a filter on the document I'm working on.


Save the script/filter in
~/Library/Application Support/BBEdit/Text Filters/

Open the Text Filters palette from the Window menu.

Optionally set a key short-cut for the script

The filter will operate on selected text in the front document 
(whether saved or not) or, if there is no selection, on the 
whole text.


Here's an example of a Perl text filter:

#!/usr/bin/perl
while () { # read the document/selection line by line
  s/a/A/g; # change all 'a' to 'A'
  print; # replace the line with the modified line
}

# 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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Text Factory Confusion

2013-04-08 Thread John Delacour

On 08/04/2013 01:49, Rich F wrote:


I have a file I'm editing where a list of filenames I need to shove into an
array.  I thought this would be a great reason to write something up that
shoves this list into an array format, or close enough to edit by hand
afterwards.

I am thinking since it's only applicable to the highlighted text, I can
have a rule to apply just to that, much like a pulldown menu.


If you give a sample of the selected file list you are referring to and 
also let us know what you mean by array format - which could be 
anything, depending on the context - then it should be possible to 
suggest a suitable Text Filter to do what you want.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: preview in last browser

2013-04-03 Thread John Delacour

On 03/04/2013 22:05, Fritz Anderson wrote:

My BBEdit (a 10.5.3 public beta) doesn't have that key equivalent. You 
must have added it.


Well I suppose you know how to do the same?  Preferences::Menus  Shortcuts

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Worksheet - Path to It?

2013-04-01 Thread John Delacour

On 01/04/2013 20:18, Christopher Stone wrote:


When I'm testing or learning new things I often duplicate a worksheet to create 
a save-point, so I don't foul up code I've gotten working (and won't remember 
accurately a few hours hence).  I may also alter my data files to fit the 
direction I'm moving.

I get tired of having to reset hard file paths, so I want to be able to make 
them relative to the worksheet.

With what I've got I can auto-set the working directory or just create relative 
paths, but I'm curious to know what other people have done.


Whatever you're actually trying to achieve it seems to be a horribly 
contorted way to do it.


Why are you using a Shell Worksheet, which is the very last thing you 
need if you want your paths to be relative to it?  I have tested and 
learned a few new things in BBEdit without ever once creating a Shell 
Worksheet.


If you save this script in a plain text document named temp.sh then the 
value of $PWD will be the path to the enclosing directory



#!/bin/bash
echo Current Directory:  $PWD 
Directory Listing:
ls;

The same goes for any sort of script, Perl, Python, w.h.y.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Regaining mindshare for BBEdit

2013-03-19 Thread John Delacour

On 19/03/2013 04:41, Oliver Taylor wrote:


** Incremental find

I completely agree with this one. Incremental find that's good enough, and 
quick enough to use, for skipping around lighting-fast inside a paragraph is 
something I sorely miss from other editors. I've written my own scripts for 
this, but a built-in solution would be better.


In BBEdit if you type command-option-F then you have incremental find.  
Perhaps that's not what you mean.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to default File|Open to Everything rather than All BBEdit Documents

2013-03-17 Thread John Delacour

On 23/02/2013 11:29, David Quigley wrote:

Running BBEdit 10.5.2, File|Open now defaults to Enable: All BBEdit 
Documents. How can I change the default to Enable: Everything? As 
far as I can tell this is a new behavior as of a recent update. I 
often open text files with odd extensions and this adds a step every time.


Running version 10.5.3 (3271)

I was running the previous beta when I tested this.  When I had once set 
Everything in the Open dialogue it stuck for all future Opens.  I have 
just updated to the latest beta 
http://pine.barebones.com/seeding/bbedit-1053_3271.dmg and 
Everything was the default, so I can't reproduce this problem.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Would prefer old Zap Gremlins / Replace with Code behavior

2013-03-16 Thread John Delacour

On 15/03/2013 22:48, Michael Wiik wrote:

For legacy issues all our html is vanilla ascii. To find non-ascii my 
workflow has been:


 zap gremlins, replace with code
 search for the resulting hex codes
 use each in a find/replace to replace all such occurrences with their 
mnemonic or numeric equivalent


Why preserve such a bad legacy?  All you need to do is save the files 
as UTF-8 and declare UTF-8 in the headers.  The use of mnemonic or 
numeric equivalents is absolutely unnecessary and often leads to quite 
anomalous results, especially when multiple-byte characters are 
involved.  What you are doing is a quite unnecessary hang-over from the 
1990s.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit Opens When I Click on the Desktop Icon in the Finder

2013-03-15 Thread John Delacour

On 14/03/2013 18:04, Thomas Hart wrote:


..Whenever I have a window open in the Finder, and I want to view the list of 
documents in the Desktop, I click on the Desktop icon in the sidebar, and 
BBEdit opens...


Try dragging the Desktop icon out of the side-bar and then drag in a new 
one from your home folder (~/Desktop)


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Strip away all HTML, leaving just the URLs

2013-03-07 Thread John Delacour

On 06/03/2013 15:58, Nick wrote:

Thanks, that did exactly what I was looking for. But, I realized I 
also need to do this for anchor tags with relative links, such as:

a href=/xxx//zzz.shtmlordinateur de bureau/a


A text filter something like this should do everything you want provided 
you haven't got more than one URL per line.


#!/usr/bin/perl
use strict;
my $f = /tmp/url.txt;
open my $fh, , $f or die $!;
while () {
/href ?= ?([^]*)/ and print $fh $1\n;
   print;
}
`open -a bbedit $f`;

#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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Learning GREP - need help with one example

2013-03-06 Thread John Delacour

On 05/03/2013 23:13, Scott wrote:

One quick follow-up. I like the idea of using scripts and textfilters. 
eremita's script example was perl, I see. I have no experience with 
perl, but I am guessing you can just script in BBEdit and save to a 
textfilter folder that BBEdit uses...?


I suggest you read the thread Help getting an AppleScript to run as a 
text filter in postings up to 25th Feb, and especially my last posting 
in that thread.  This should make things very clear and show how simple 
it is.  AppleScript, by the way, doesn't come into it.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Learning GREP - need help with one example

2013-03-05 Thread John Delacour

On 05/03/2013 04:54, Scott wrote:


Let's say I have a URL like this:

*http://www.mysite.com/section/subsection/Z3245678a34/*

And I want to turn it into an html link with the last element as the 
highlighted text:


*a 
href=**http://www.mysite.com/section/subsection/Z3245678a34/**;Z3245678a34/a*

*
*
What would I use as the search  replace values?

I hope to learn how to find substrings between certain characters 
(like /). The *Z3245678a34* could be anything. Unicorn123, 
mypage, learningisfun4all.
If I were doing this regularly, I'd use a text filter, which is far more 
powerful than the built-in search/replace dialog.  An example is below.


As to places to find out about regular expressions, you will find 
hundreds, but look for regex or PCRE 
http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions (the 
variety used in BBEdit) rather than 'grep'.



#!/usr/bin/perl
use strict;
while () {
if (m~http://(.+\b)(/?)~i) {
  my $url = $;
  my @parts = split /, $1;
  my $link = pop @parts;
  print qq~a href=$url$link/a~;
} else {
  print;
}
}

--
--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread John Delacour

On 01/03/2013 21:06, Patrick Woolsey wrote:

At 12:45 -0700 03/01/2013, LuKreme wrote:

If BBEdit did not have a Hard Wrap function and you had to recreate it
via a text factory, would it be possible?

Not with a text filter, though one could do this with a suitable script.

No, Patrick, this can be done with a text filter.  For example:


#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
my @text;
while () { push @text, $_ }
print wrap('', '', @text);

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread John Delacour

On 01/03/2013 22:03, I wrote:


No, Patrick, this can be done with a text filter.  For example:


#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
my @text;
while () { push @text, $_ }
print wrap('', '', @text);


or more simply

#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
print wrap('', '', );

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Justify Text

2013-02-26 Thread John Delacour

On 26/02/2013 23:29, Cerebus wrote:
  
Sometimes, though not very often, I want to justify plain text. When I want to do this, I use vim since as far as I know there isn't a way to do it in BBedit.


BBEdit is a text editor and to talk of justifying plain text is a 
contradiction in terms.  There is no way to do true justification in any 
plain text editor.  If you use a monospaced font then sure you can add 
spaces arbitrarily to space things out, but that is not proper 
justification, which relies on kerning and other rules not available in 
any text editor.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pass Parameters to Text Filter Script

2013-02-24 Thread John Delacour

On 24/02/2013 19:34, Oliver Taylor wrote:

On Feb 24, 2013, at 2:55 AM, ctfishman mfisc...@casciac.org 
mailto:mfisc...@casciac.org wrote:



Is it possible to pass parameters to a script being run as a text filter?


No. You'd have to use an AppleScript to prompt for parameters and pass 
those to your script (or something similar).


The parameters can be typed at the beginning of the document.  For 
example, you have a document with the text:


bag
lag

and you want to change all the a's to o.

Add lines to the beginning, so that you have:

a
o
bag
lag

When you run the filter below, the first two lines will supply your 
parameters and be deleted.  The remaining lines will be processed using 
the arguments supplied, and you will end up with


bog
log


#!/usr/bin/perl
use strict;
my $i = 0;
my $param_1;
my $param_2;
while(){
$i++;
chomp ($param_1 = $_) and next if $i == 1;
chomp ($param_2 = $_) and next if $i == 2;
s~$param_1~$param_2~i;
print;
}

--
--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Write changes to two destinations on save

2013-02-16 Thread John Delacour

On 16/02/2013 00:04, Nick wrote:

...When I save a file, DW would save the file and write a copy to that 
dev server...


It sounds as if you want a Menu Script.  You can read about these in the 
manual and then ask the list if there are difficulties.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A Find Problem

2013-02-13 Thread John Delacour

On 13/02/2013 02:32, Jim Harvey wrote:


  I do some grep searching once in a while, but this one has me stumped. I have 
some large text files, and I need to find the nth occurrence of a string (or 
pattern).


Here's an AppleScript script that finds the 4th occurrence of do in 
the front document. I expect someone can give you a less clumsy way to 
do it.


set _regex to do
set _n to 4
set _i to 0
set _max to 1000 -- max possible occurrences
tell application BBEdit to tell the front document
activate
select insertion point before character 1
repeat _max times
set _i to _i + 1
find _regex ¬
options ¬
{search mode:grep} ¬
searching in its text ¬
with selecting match
if _i ≥ _n then
exit repeat
end if
end repeat
end tell

--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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Replace characters in selection

2013-02-08 Thread John Delacour

On 08/02/2013 02:17, Zephyr Mays wrote:

...I'd like to select/highlight something like: 
 These_Underscores_Need_To_Be_Spaces


Hit a keyboard shortcut to end up with: These Underscores Need To Be 
Spaces


In almost all such cases a text filter is the solution.  If you save the 
script below in your Text Filters folder, you will be able to set a 
key-shortcut in the Text Filters palette.  The palettes sub-menu is 
under the Window menu.


#!/usr/bin/perl
while() {
  s~_~ ~g;
  print;
}

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Wrap List Text Filter

2013-01-30 Thread John Delacour

On 30/01/2013 20:20, Marek Stepanek wrote:


And how you apply this ruby script to the selected text? I have no idea,
how ruby is working ...

It works just as a Perl script works, as a filter

Here a little perl-filter. Adapt the first paragraph number to your
needs: my $para_nr = sprintf(%3s,1) if you have already some numbers
before.


Here’s an alternative that left-aligns the text. It probably
needs a little tweaking.

#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 60;
my $n = 1; my $number;
my @paras = ;
my $padding = 2;
$padding = 3 if scalar @paras  99;
my @new_lines;
for (@paras) {
$number = sprintf (%$padding\d. , $n);
push @new_lines, wrap($number, , $_);
$n++;
}
print @new_lines;

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Default Preview Font

2013-01-28 Thread John Delacour

On 27/01/2013 19:11, Steve Hodgson wrote:
Is it possible to change the appearance of the font used for 
previewing files? I don't particularly want to style it with CSS - 
just reduce the size and switch to sans serif.

Is this really too much trouble?!

style
  body{font-family:sans-serif;font-size:90%;}
/style

--
--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group, send email to 
bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help getting an AppleScript to run as a text filter

2013-01-24 Thread John Delacour

On 24/01/2013 23:26, Adam Engst wrote:


BBEdit and perl FTW! cheers...


As a postscript to this thread I think it’s worth emphasizing how 
wonderfully simple it is to use Perl RE in text filters by explaining 
just what is happening.  BBEdit has set things up so that the input to 
the text filter is the whole text of the front document, unless a 
selection is highlighted, in which case the selection alone is taken as 
the input and the remainder of the text left intact.


A text filter saved with the suffix .pl or beginning with the shebang 
#!/usr/bin/perl will be recognized as a Perl filter.


The array (list) of lines in the text is written STDIN (= lines in 
Standard Input) or simply , and the ‘while’ block iterates through 
this array item by item; that is to say it processes the text line by line.


we have:
#!/usr/bin/perl
use strict;
while () {
# do this; do that; do the other
s~^(\s*)([a-z])~\U$1$2~; # capitalize the first letter in the line
print;
}

This means: for each line of input, do these things and write the 
(modified) line.


Without needing to learn any Perl at all more than this it is thus easy 
for anybody who has gone to the trouble of learning how to use PCRE in 
BBEdit to write Perl text filters to do substitutions using what is 
_almost_ the same lingo.  Anyone who does this is bound to get a craving 
for a little bit more, and again it will be necessary to learn only a 
tiny bit more Perl syntax at a time and not the whole lot.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Help getting an AppleScript to run as a text filter

2013-01-16 Thread John Delacour

On 16/01/2013 17:32, Adam Engst wrote:

(This paragraph is an example of lazylinks - the two links should be 
numbered 1 and 2.)


[*]: http://tidbits.com/
[*]: https://leanpub.com/


Adam,

I’m afraid I find AppleScript impossibly verbose for this kind of simple 
text munging.  I don’t know what your docs look like but, supposing each 
link is on a separate line, then the Perl script below, saved as a text 
filter, will change all the asterisks to the appropriate number.  If 
not, then the script can almost certainly be modified to do the job, 
however the doc is laid out.  This script presumes that the docs have 
UNIX line endings.  If they don’t then again it can easily be modified.  
If you post a snippet from a typical doc then it will only take a few 
moments to write a working filter



#!/usr/bin/perl
while () {
if (m~http://tidbits~) { s~\[\*\]~[1]~ }
if (m~https://leanpub~) { s~\[\*\]~[2]~ }
print;
}

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Does anybody what happened to the unsaved dot from 10.5 BBEdit?

2012-12-14 Thread John Delacour

On 12/12/2012 15:07, Patrick Woolsey wrote:

For the record, BBEdit 10.5 darkens the icons of modified files in the 
file list and file nav popup ...


Hello Patrick,

In the latest beta there is no sign _at_all_ that the document is unsaved.

JD




PS. (Case 256307) Of course, you are right.  Because I use a key 
shortcut to switch soft-wrap I had forgotten there were options in the 
pop-up menu.


--
--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Mixed line endings problem

2012-12-14 Thread John Delacour

On 11/12/2012 04:33, Troy Gillette wrote:

We have several million lines of code from the last ten years. C, C++, 
Objective-C, Ruby, Python, XML, numerous others... Nothing in our 
process cares whether anything ends in LF or CR+LF, but BBEdit does.


I think, in contrast to some others, that you have a good point. And the 
point is that BBEdit, having determined, by a test of the first line or 
so, that the line-endings are one byte then proceeds to convert each 
individual \r or \n into the default line-ending. In my case that is \n 
and a mixed document such as you are talking of, will end up with \n\n 
where there was \r\n and there is no way to distinguish in BBEdit 
between what was a DOS line end and what was a blank line.


So the only way to resolve the problem is to regularize the line endings 
before BBEdit gets its hands on the doc.  The best way to do this, it 
strikes me, is to run all the files through a UNIX or Perl filter in one 
go, converting every line-end byte or pair to \n and get rid of the 
problem at source once and for all.  This is very easy to do.


On the other hand I do think it is something that BBEdit should do 
automatically, because it makes no sense to convert \r\n to \n\n, as now 
can happen, under any circumstances.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: A different kind of select word

2012-12-14 Thread John Delacour

On 17/10/2012 23:10, Oliver Taylor wrote:

Is it possible to test the found text*of* nextChar as regex?

If you can point me in the right direction, I'd be grateful.

*tell* /application/ BBEdit


--look at the next character
*set* nextChar*to* *find*. searching in/text/*of* *front* /text 
window/options{search mode:grep, wrap around:false}



*if* found text*of* nextChar=   *then* --should also test for 
punctuation



You don’t need to use regular expressions but rather do something like this:

tell application BBEdit
  set _matched_chars to {space, tab, \, '} -- etc.
  set _nextchar to (characterOffset of selection)
  tell the text in the front text document
set _char to (character _nextchar as string)
if _char is in _matched_chars then
  --
end if
  end tell
end tell

--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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Does anybody what happened to the unsaved dot from 10.5 BBEdit?

2012-12-13 Thread John Delacour

On 12/12/2012 15:07, Patrick Woolsey wrote:

For the record, BBEdit 10.5 darkens the icons of modified files in the 
file list and file nav popup instead of displaying an unsaved dot as 
prior versions did. (We made this change as part of the process of 
adding Retina support, and it also follows current Mac UI convention.)
If you were to darken the icon in the title bar it might be ever so 
slightly noticeable.  The more I see of “current Mac UI conventions” the 
more I am tempted to break a habit of 38 years and switch to Linux.  
Microsoft seems to be the only developer that pays any heed to the 
time-honoured Apple HIG in certain respects.  In many apps you can’t 
even do ⌘S for save or ⌘D for don’t save, let alone ⌘C for cancel.  
Instead, after typing ⌘W, rather than move one finger one or two places, 
you need to reach for the esc key or the return key. If that’s what the 
junior wizards at Apple consider ergonomic they deserve to work for 
London Transport. As for the new-fangled “sheets” that ask you to save 
something that you can’t even see for the damn sheet in the way, what 
genius thought up that great idea?! And what about scriptable apps?  In 
TextEdit you can’t even get the selection using Apple Events or in Mail 
the properties of the message in the front window.  In Preview you can’t 
to anything at all.  I could give you a list as long as my arm.


I say, to the devil with Apple’s innovations.  I stick with BBEdit 
because it is grounded in a tradition that predates all this nonsense, 
not because I am dying for it to jump on the “really really great” 
self-congratulatory band-wagon.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: restoring bbedit state is absolutely annoying

2012-12-13 Thread John Delacour

On 13/12/2012 18:18, cancerinform wrote:

By some reason I did something and now whenever I open bbedit a little 
window appears with a scrollbar telling me that bbedit state is 
restored. This results in eliminating the rest of my harddrive that I 
only see the bbedit window. I cannot reverse this and it is absolutely 
annoying.


I won’t swear to this but I presume this only happens when you quit 
BBEdit with unsaved documents and BBEdit is restoring these documents 
from the autosave cache.  I find it very convenient to have this new 
possibility and can easily tolerate the few seconds it takes for BBEdit 
to restore the state at quit.  I imagine that if you save all your open 
windows before quitting,including all those untitled snippets that you 
really don’t need ever to see again, you will avoid this minor 
inconvenience at the cost of what I consider a greater chore.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: restoring bbedit state is absolutely annoying

2012-12-13 Thread John Delacour

On 13/12/2012 22:09, Oliver Taylor wrote:

On Dec 13, 2012, at 1:59 PM, John Delacour johndelac...@gmail.com 
mailto:johndelac...@gmail.com wrote:


This results in eliminating the rest of my harddrive that I only see 
the bbedit window.


That do you mean by this?...


What do _you_ mean by attributing this to me!

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Running Python scrips from the Shebang menu

2012-12-11 Thread John Delacour

On 11/12/2012 21:39, vaboro wrote:

When I tried to run Python script from the Shebang menu I got the 
following message:


usr/bin/python: No such file or directory

I supposed BBEdit had tried to find Python executable in 
usr/bin/python directory.


I spent couple of hours trying to find out what's wrong with my 
environment variables, but couldn't get a clue until I specifically 
put the following line in the beginning of my Python script:


#!/usr/bin/python

And it worked.


It is so unusual to use #!usr/bin/python rather than 
#!/usr/bin/python that I’ve never seen it!


However, provided you have made your document a Python document or, I 
guess, added the .py suffix, the script in the front window will run 
from the run command without any shebang.  Try doing that and running 
just this:


import os
print os.getcwd()

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Services : Convert Chinese... missing from menu

2012-12-09 Thread John Delacour
I have the Chinese conversion items checked in Keyboard Shortcuts 
preferences, ie. Convert Text from Simplified to Traditional and vice 
versa, according to context, but the items are not available in the 
Services submenu in BBEdit.  Can someone please tell me if it’s possible 
to have them show up.  I have them in TextEdit, in Apple Mail and in 
Contacts, but not in AppleScript Editor, and not in BBEdit or TextWrangler.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: text factory results to scratchpad / new document

2012-11-21 Thread John Delacour

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





AppleScript script modified by BBE

2012-11-15 Thread John Delacour


If I am editing a BBEdit AppleScript script in Script Editor and run it 
from BBEdit, the next time I edit the script I am told it has been 
modified [by BBEdit’s having run it], and I have to ‘Save anyway’.  This 
is not a great inconvenience but I’m curious as to why it should happen.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: AppleScript script modified by BBE

2012-11-15 Thread John Delacour

On 16/11/2012 02:16, Steve Kalkwarf wrote:

Does the script have any properties? Steve 


None declared as such.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Greppng

2012-10-31 Thread John Delacour

On 31/10/2012 16:40, LuKreme wrote:


I want to grep for words in a file that contain 'a' 'b' and 'c' in any order. I 
also want to find words that contain two c's, even if not together (so access 
and chance).

I might even want words with two c's AND a and b, again in any order.

I feel like I am forgetting something basic.


As for most of these things, as text filter is the best solution. This:

#! /usr/bin/perl
use strict;
while () {
print;
my @hits;
my @words = split /\b/, $_;
for (@words) {
push @hits, $_ if /a/i and /b/i and /c/i or /c.*c/i;
}
printf • Found: %s\n, join , , @hits if @hits;
undef @hits;
}

will turn
The accountant sat in the back of the
cab wearing a black cocked hat
into
The accountant sat in the back of the
• Found: accountant, back
cab wearing a black cocked hat
• Found: cab, black, cocked

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: BBedit scripting..

2012-10-24 Thread John Delacour

On 24/10/2012 05:59, G.Shaw wrote:

I'm new to BBEdit. I'm trying to do the following:

Input:
ShipAddress1884 MapleAve SE/ShipAddress1
ShipAddress2 /
ShipCityCumming/ShipCity
ShippingPriorityGround/ShippingPriority
...

1. Reorder the above such that it's ShippingName, ShippingAddres1,...etc


You can do this with a text filter (see recent posts or read the manual) 
like this:


#! /usr/bin/perl
while () {
s~Ship([A-Z])~Shipping$1~g;
print;
}

or simply with the built-in find/replace, setting case-sensitive on and

find: Ship([A-Z])
replace all with: Shipping\1

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Warn when file type is NOT unix (or Mac)?

2012-10-24 Thread John Delacour

On 24/10/2012 01:50, Rich Siegel wrote:

In this case I would actually recommend using a script attachment 
point, rather than trying to hook on to a menu item; you'll get better 
behavior.


Rich,

Could you please post a working example of Document.scpt containing the 
two handlers

documentShouldSave and documentWillSave.

I have tried to follow the instructions given in the manual and am 
clearly missing something, since nothing happens.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Sequential numbering

2012-10-23 Thread John Delacour

On 23/10/2012 10:43, Stuart Gilson wrote:


How do you refer this perl script to a file or files?


The script takes the whole text of the front document as STDIN (input) 
unless you have made a selection, in which case it takes the selection. 
« while () { ... » means, in effect, while reading the 
document/selection line by line.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Sequential numbering

2012-10-23 Thread John Delacour

On 23/10/2012 19:47, Bruce Van Allen wrote:

The other part of the answer is that you save the script with a 
memorable name in a text file and put the file in 
~/Library/Application Support/BBEdit/Scripts. It will then show up in 
BBEdit's Scripts menu (the one that looks like a scrolling sheet of 
paper).


Scripts of this kind will not work as intended if you put them in the 
Scripts folder; they are text filters and belong (in BBE 10.5) in 
~/Library/Application Support/BBEdit/Text Filters/.  In previous 
versions they belonged in ../UNIX Filters.


Both scripts and text filters are assigned palettes, and I find it most 
convenient to keep both palettes open and assign key shortcuts to 
scripts or filters that I use often.  This is far less tiresome than 
using the menu, and, more to the point, there is no menu for text filters!


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Customize palettes?

2012-10-22 Thread John Delacour

On 22/10/2012 17:22, Patrick Woolsey wrote:

That will not work, and as a general reminder, please do *not* modify 
anything within the application package as doing so is liable to 
create problems.


Certainly!  I was not suggesting modifying anything in the application 
package.  It was a modified _copy_ in app. support that I suggested 
might work, as such a device would work in good old Eudora, for example.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Customize palettes?

2012-10-20 Thread John Delacour

On 20/10/2012 04:32, Frances Cherman wrote:
Thanks, Patrick. Can anyone else definitively say whether or not it's 
possible to customize the palettes?


Whether or not this would work, is for the BB people to tell you, but in 
some apps it would...  The file below:


/Applications/BBEdit.app/Contents/Resources/BBMainHTMLPaletteConfiguration.plist

could be copied to BBedit’s Application Support folder (¿perhaps within 
a folder named “Resources”?) and this copy edited to obtain the 
configuration you want.  This would then override the default file 
within the app bundle.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Unix scripts not working in 10.8.2

2012-10-06 Thread John Delacour

On 05/10/2012 20:52, François Schiettecatte wrote:

Dumb question, have you checked that the script has execute permissions?
chmod 755 myScript.pl
I’ve explained why the scripts weren’t working, and it has nothing to do 
with permissions. A script does not need to be executable in this 
environment.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Unix scripts not working in 10.8.2

2012-10-05 Thread John Delacour


I installed Mountain Lion yesterday, probably the worst decision I ever 
made! Some of Apple’s own main apps now seem to be buggier than they 
were 5 years ago with no useful new features.


None of my UNIX filters in BBEdit are now working.

For example this script

#!/usr/bin/perl
while () {
print * $_
}

should put an asterisk at the beginning of each line in the front 
document but nothing happens at all with this script or any other.


Mountain Lion has caused me so much trouble that I’m now exhausted, so 
perhaps I’m missing something obvious.


Any help out there?

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Unix scripts not working in 10.8.2

2012-10-05 Thread John Delacour

On 05/10/2012 21:54, Doug McNutt wrote:

At 20:43 +0100 10/5/12, John Delacour wrote:

None of my UNIX filters in BBEdit are now working.

For example this script

#!/usr/bin/perl
while () {
print * $_
}

should put an asterisk at the beginning of each line in the front document but 
nothing happens at all with this script or any other.

You might need a semicolon after the print, But it is the last line between {}s 
so whonoze?
I said _none_ of the UNIX scripts were working, not that I doubted my 
ability to write a simple Perl script! In fact a semi-colon in this 
position is redundant, though I could add ;;; without breaking it.


I have discovered the reason, and that is that BB have rearranged the 
files in the Application Support folder. The UNIX filters and scripts 
should have been moved to ../BBEdit/Text Filters/ but they have been 
moved to ../BBEdit/Scripts/Text Filters/, and that's why they weren’t 
working. I found this out by RTFM p.34.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Subpatterns in Grep?

2012-10-05 Thread John Delacour

On 5 Oct 2012, at 16:18, jmichel jmi.mig...@gmail.com wrote:

 I have a file consisting of groups of lines (unknown number of lines in each 
 group). 
 Each line begins by a 6 digit number, followed by an unknown sequence of 
 words and numbers. 
 Consecutive lines starting with the same number form a group.
 My problem is to combine lines from each group into a single line, keeping 
 only the first occurrence of the distinctive number.
 I have been able to find groups using the pattern
 (\d{6})(.+)(?:\r\1(.+))+
 However, this does not appear to store the expressions matching the inner 
 parentheses into separate variables. 
 Is there a way to achieve the desired replacement using grep?

Using regular expressions yes, but you need a routine.  If you put a file 
containing
this Perl Script in ~/LibraryApplication Support/BBEdit/Text Filters, it will 
do what
you want.  Open the Text Filters palette from the Window menu and you will see 
the
filter.  Double-click it or click on Run or, if its a frequent task, assign a 
shortcut to the
script.

Save this as ???.pl

#!/usr/bin/perl
my %hash;
my $six_digits = [0-9]{6};
my $remaining_text = .*;
my $delimiter = ; # or ,  for example
while () {
if  ( /^($six_digits)($remaining_text)/ ) {
$hash{$1} .= $2 # append the text after the 6 digits
}
}
for (sort {$a=$b} keys %hash) {
print $_$delimiter$hash{$_}\n
}

#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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Scripting ListDisplayFont

2012-09-30 Thread John Delacour


I'd like to be able to change ListDisplayFont on the fly using a 
script, shell or AppleScript.


The nearest I've got to anything useful is setting the preferences 
window to open with the Appearance pane selected...


defaults -currentHost write com.barebones.bbedit 
BBPreferencesSelectedModuleIdentifier BBAppearancePreferences


but this does not take immediate effect and I need to relaunch for 
the change to be noticed, which is not useful.


When I look at ListDisplayFont in the plist file I see a long encoded 
binary value, so it's no good my even trying to edit that.


Is there a way?

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Scripting ListDisplayFont

2012-09-30 Thread John Delacour

At 09:10 -0400 30/9/12, Rich Siegel wrote:


It's not currently possible; what problem are you trying to solve?


It's not so much a problem as a missing convenience.  I'm building a 
functional application within an application using the TextWrangler 
interface together with a custom Application Support directory.  It 
would be nice for users to set the pref simply by running a script 
from the palette, but I can easily have the script open the prefs 
window and put up a dialog telling them to switch to the Appearance 
pane.


Thank you.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Scripting new disk browser

2012-09-28 Thread John Delacour

At 10:34 -0400 27/9/12, Rich Siegel wrote:



I want to make a new disk browser showing the contents of a certain folder.


set p to POSIX file /Users/siegel/Library/ -- or some other folder

tell application BBEdit
open p
end tell

Enjoy,



I certainly shall!  Thank you, Rich.


--
--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Scripting new disk browser

2012-09-27 Thread John Delacour


I want to make a new disk browser showing the contents of a certain 
folder.  I am having no success.  Here's one routine I've tried:


set _dir to alias x:y:z  -- any alias is a file that _exists_!
tell application BBEdit
  set _dbw to make disk browser window
  tell _dbw
set its selection to {_dir}
  end tell
end tell

and here's another

set _f to alias x:y:z
tell application BBEdit
  make disk browser window with properties {selection:{_f}}
end tell
--=  error BBEdit got an error: An attempt was made to 
resolve an Apple Event reference to a non-existent object (MacOS 
Error code: -1728) number -1728 from disk browser window



The sdef dictionary under 'window' gives 'selection' as a writable 
property, and the disk browser window has certainly has the property 
selection:{file p:q:r}.


It seems to me BareBones makes no distinction between file x and 
alias x, so this adds further complications.  From the year dot, 
file x need not exist, whereas alias x must exist.


Can anyone provide me with a working example?

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: grep help

2012-08-06 Thread John Delacour

At 21:20 -0700 4/8/12, Steven wrote:



I am trying to remove a date string from an SQL file.

I have ,'\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d', as the string I wish 
to replace with  ,


It does not like that.

I assume I have to \- because - is a character grep uses



The search pattern on the next line, with or without escaped hyphens:
,'\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d',

will find strings like this:

,'2012-08-08 22:22:22',

in a plain text file.

What is your difficulty?

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit





Re: Block commenting

2012-06-23 Thread John Delacour

At 12:11 -0700 22/6/12, Emmanuel Décarie wrote:


I want this:

// if ($operateur == !) {
// if ($reponses_utilisateur[$T][$CT] != $reponse) {
// return 1;
// } else {
// return 0;
// }
// }



Try this text filter:

#! /usr/bin/perl
use strict;
my $indent;
while () {
 if (!$indent) {
   m~^(\s+)~ and $indent = $1;
 }
  s~$indent~$indent// ~;
  print;
}
__END__

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Move to beginning of line after whitespace

2012-06-04 Thread John Delacour

At 11:46 -0700 3/6/12, Oliver Taylor wrote:


I'm trying to write an applescript that emulates vim's go to first 
non-whitespace character on the line.


I'm also building it to be smart about skipping lists (since most of 
my writing is prose).



Try this:


tell application BBEdit
  set _line to startLine of selection
  tell front document
set _chars to characters of (get contents of line _line)
set _i to 0
repeat with _c in _chars
  set _i to _i + 1
  if _c is not in {space, tab} then
select insertion point before character _i of line _line
exit repeat
  end if
end repeat
  end tell
end tell


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Can any AppleScript gurus help? Script to get filename of active dialog

2012-03-09 Thread John Delacour

At 06:55 -0700 9/3/12, LuKreme wrote:



On 08 Mar 2012, at 21:57 , Mark Christian wrote:

  can get the filename of the front-most document in BBEdit, but I'm
  afraid I just don't grok AppleScript.

set docName to name of text window 1


That will get you the name of the window.

This will get you the file name:

tell application BBEdit
  POSIX path of (get file of front document)
end tell

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Can any AppleScript gurus help? Script to get filename of active dialog

2012-03-09 Thread John Delacour

At 19:23 -0700 9/3/12, LuKreme wrote:


On 09 Mar 2012, at 09:21 , John Delacour wrote:

  At 06:55 -0700 9/3/12, LuKreme wrote:
   can get the filename of the front-most document in BBEdit, but I'm

  afraid I just don't grok AppleScript.

set docName to name of text window 1


 That will get you the name of the window.


When are they different?


1. When the document has not been saved
2. The expression filename is generally used to signify the full 
path of the file, and not just its name.


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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: How to do a repetitive insert/edit

2012-03-05 Thread John Delacour

At 22:20 -0800 3/3/12, blue-orange wrote:



This sounds very helpful JD. Can you give me few pointers how to save
and run the Text Filter please?


Save the script as Perl, with UNIX line endings, UTF-8 etc., in

 ~/Library/Application Support/BBEdit/Text Filters

Run it from the Text Filters palette (opened from the Window menu).

You can add key-shortcuts to scripts you use often.

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: How to do a repetitive insert/edit

2012-03-03 Thread John Delacour

At 00:19 -0500 3/3/12, Robert A. Rosenberg wrote:

I have two HTML files. One is a list that I want to use as links to 
the other file. Is there any way I can automatically edit the list 
file to create unique ids for the URL#id tag and corresponding 
id=tag in the other file?



Provided you have the same sequence in both files and no false 
positives, the following Text Filter will do the substitution in 
either file:



#!/usr/bin/perl
use strict;
my $i1 = 1; my $i2 = 1;
while (){
  s/(html#id)#/$1$i1/ and $i1++;
  s/(id=id)#/$1$i2/ and $i2++;
  print;
}

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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


  1   2   3   >