Re: BBEdit - Find Replace using a list

2011-09-02 Thread eremita


On Sep 2, 9:37 am, I wrote:

 BBEdit does it's cleverest stuff...

its, I mean!

 If you paste this script into Script Editor and run it...

The script is not actually making the right substitutions in
the files' contents and I haven't time to sort out the error right
now.  Perhaps someone else on the list will sort it out.

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 - Find Replace using a list

2011-09-02 Thread Roland Küffner

Am 01.09.2011 um 1, 02:05 schrieb JT:

 Hi,
 
 I have 30 language files that I automate graphics production and the
 text files are identical except each one calls a new file in the path.
 For example,
 
 file://KR.tif
 
 and I need to change the 'KR' to AU, GB, DK and so on and save each
 find and replace as a new text file. Can this be done with BBEdit? Is 
 this something else other than what BBEdit was designed for?

Hi,

the scripts from John and Chris provide pretty good solutions (as always with 
that two very kind and helpful list members). I just wanted to add a different 
way to achieve this without the need for scripting (ok, I'm using some shell 
commands but only the most basic ones). I would use BBEdit's Shell Worksheets 
and placeholders to do this:

Assuming you have a folder myproject on your desktop and your master file is 
placed in it and named master.txt, do the following.

1) In your master file replace every occurrence where you want to change the 
language code with #BASENAME# (in your example file://KR.tif would become 
file://#BASENAME#.tif)

2) Open a new Shell Worksheet and write this in it:

cd ~/Desktop/myproject
cp master.txt EN.html
cp master.txt DE.html
cp master.txt GB.html
... and so on

(extra tipp: just write down a list of your abbreviations one on each line, 
select all lines and use Text  Prefix/Suffix Lines to add everything else in 
one go)

And: just ignore, that your duplicate files are will be html files. They need 
to be named such to make step 4 work.

3) Select all lines from step 2 and hit Enter (not return!) This should execute 
all the lines duplicating your master file into all the needed language 
versions.

4) Select Markup  Update  Folder and update the myproject-Folder. (This 
command will ignore simple text files, so we had to disguise them as html in 
step 2).

This step should replace the placeholders in each file with the filename text 
(EN, DE, ...).

5) Rename the files back to something meaningful after updating them. Just 
repeat the technique from step 2 with a list of commands similar to:
mv EN.html 'my more meaningful file name_EN.txt'
mv DE.html 'my more meaningful file name_DE.txt'
and so on ...


I don't want to compete with the elaborate script solutions already provided. I 
just wanted to add, that BBEdit provides powerful tools you can use to create 
simple quick and dirty solutions that are very flexible and may be easier to 
adapt to similar problems (same, same, but different). To learn it's powers, I 
highly recommend to read the very fine manual on a rainy weekend (or even 
before that).

happy editing,
Roland

-- 
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: Codeless Language Module / Function definition

2011-09-02 Thread Robert M . Münch
On 1 Sep., 22:25, Ronald J Kimball r...@tamias.net wrote:

 It appears that you have three left parens and four right parens.

That's just a typo here.

 That first asterisk also looks suspicious to me.  Should there be a period
 before it or something?

.* would mean every character 0 or more times. With the character
class in front and the + it should mean: These characters 1 or more
times.

 Yes, that is what the x means.  The colon just marks the end of the flags.

Ok. Thanks, that's not documented anywhere I looked at...

-- 
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


Paging up down and currently selected line

2011-09-02 Thread Robert M . Münch
Hi, why doesn't the cursor move when I page up and down in a file? I'm
always catches by paging to the place I need and start typing, which
results in BBedit jumping back to the still old actual line... how can
I change this.

And, it would be nice to add CMD+V without any selection to copy the
whole current line.

-- 
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: slow repeat rate in 10 on lion

2011-09-02 Thread Robert M . Münch
On 2 Sep., 05:36, Seth Dillingham s...@macrobyte.net wrote:

Hi, I have the same problem it's not fast enough.

 Other than for selecting text, why would you need a really fast
 key repeat?

Well, to move the cursor around very fast ;-). If you have a lot of
code, it's just waste of time.

Robert

-- 
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: Codeless Language Module / Function definition

2011-09-02 Thread Ronald J Kimball
On Fri, Sep 02, 2011 at 08:09:46AM -0700, Robert M. Münch wrote:
  That first asterisk also looks suspicious to me.  Should there be a period
  before it or something?
 
 .* would mean every character 0 or more times. With the character
 class in front and the + it should mean: These characters 1 or more
 times.

So what is the purpose of the asterisk here?

(?Pfunction_name[A-Za-z]+)*

Ronald

-- 
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: 'Selection only' in Find dialog.

2011-09-02 Thread Govinda
I am still wiping my eyes from the tears of laughter.  I did not
realize how much need I had for comical relief about the stored stress
from the embarrassingly large amount of time I also spent, I think
twice, in the past on that same thing.

Thanks so much Lu! :-)
-Govinda

-- 
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 - Find Replace using a list

2011-09-02 Thread John Delacour

At 04:00 -0500 02/09/2011, Christopher Stone wrote:


Save the script as an Applescript and put it in the BBEdit script menu.

Give it a handy keyboard shortcut.

Open your saved 'EN' text file template from the directory you wish 
to create the new files in.


Run the script.



Ditto for my script, which now does what it's supposed to


tell application BBEdit
  tell front document to set _template_mac to its file
  set _template to POSIX path of _template_mac
end tell
do shell script perl -w 'END_OF_PERL';
use strict;
my @country_codes = qw(DE GB CN
BR KR SE NO TH CL GR);
my $template = qq~  _template  ~;
open my $fh, qq~$template~ or die $!;
my @lines = $fh; # get the lines of the doc
close $fh;
foreach my $cc (@country_codes){
  $_ = $template;
  s~(_)(EN)(\\.)~$1$cc$3~; # name the new file
  open my $fh, qq~$_~ or die $!; # create the new file
  foreach (@lines){ # loop through the lines
my $modified_line = $_; # making the country code substitutions
$modified_line =~ s~(_)(EN)(\\.)~$1$cc$3~;
print $fh $modified_line; # write the changed line to the new file
  }
  close $fh
}
END_OF_PERL

--END of AppleScript

--
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: Paging up down and currently selected line

2011-09-02 Thread Fritz Anderson
On 2 Sep 2011, at 10:52 AM, Robert M. Münch wrote:

 Hi, why doesn't the cursor move when I page up and down in a file? I'm
 always catches by paging to the place I need and start typing, which
 results in BBedit jumping back to the still old actual line... how can
 I change this.

As for why, Mac applications have behaved like this since 1984. On a terminal 
editor like emacs, there is no distinction between browsing a file and moving 
the insertion location because terminals don't have a concept of a cursor that 
isn't on the screen. The Mac design is that you shouldn't have to lose your 
place in your work just because you wanted to look elsewhere in your document.

If you use option-arrow up or down, you'll move the insertion point by a 
screenful.

 And, it would be nice to add CMD+V without any selection to copy the
 whole current line.

If I may venture to say, you'll be miserable switching between any other 
application and BBEdit. Cmd-V is Paste. People want to paste things into 
their documents even when the selection (there is always a selection) is empty.

I guess it might be possible to construct an AppleScript command to see if the 
selection is empty, find the line's contents, and copy them; or paste if the 
selection isn't empty. Then you could reassign cmd-V to the script.

— F

-- 
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


My Disappoints in BBEdit 10

2011-09-02 Thread vapor
I've really tried to like 10, but I find myself drifting back to 9.6
more and more.

The main reason is I miss my pre-populated windows. For instance, want
to add a stylesheet link in 9, just click Head Elements  Link and get
presented a nice modal with all available options. Now, in 10, I
actually have to type in (and remember) all the options.

The reason I've loved BBedit since v7 was it didn't make me type like
other text editors, etc. Yea, I know autocomplete and such, but I
loved not really thinking much about it.

And how about easy stuff like mailto:. It was just highlight an
address and click on anchor to have the modal box show all the
options. Now I have to fill in an empty box? Yea, I know this could be
done with clipping, but even that requires me to go back in and fill
in the options.

Please give me back my old modal boxes combined with the new
interface. Staying this way will guarantee my never upgrading again.


Cordially,
Kirk

-- 
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


Help with applescript for BBEdit formatting

2011-09-02 Thread Rick Yentzer
Hello, 
I'm trying to create an applescript that will insert a return, a tab, and a 
return.

-- 
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


Help with writing applescript for BBEdit

2011-09-02 Thread Rick Yentzer
 

Hello, 

I'm attempting to write an applescript that will automate some keystrokes.

What I want to occur is when I'm inside a tag like so:

taginsertion point/tag

I want to be able to run the script to get the following format:

tag

insertion point

/tag

This part I have been able to accomplish. But how do I get it to see if the 
tag is indented and if so, keep the insertion point and closing tag indented 
as well? The way it is now it will just do a \r\t\r so I end up indenting 
to get it line up correctly but that is what I want the script to accomplish 
for me.

I'm pasting my code below. Any help will be greatly appreciated.

Thanks, Rick


*tell* *application* BBEdit

*   set* myInsert *to* \r\t\r

*   tell* *front document*

*   set* theSelection *to* (*get* contents *of* selection)

*   set* contents *of* selection *to* myInsert

*  if* theSelection =  *then*

* select* *insertion point* *after* *character* ((*count* myInsert) 
- 1) *of* selection

*  else*

* select* *insertion point* *after* *character* -1 *of* selection

*  end* *if*

*   end* *tell*

*end* *tell*

-- 
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: Codeless Language Module / Function definition

2011-09-02 Thread Christopher Stone
On Sep 02, 2011, at 10:09, Robert M. Münch wrote:
 Yes, that is what the x means.  The colon just marks the end of the flags.
 
 Ok. Thanks, that's not documented anywhere I looked at...
__

Hey Robert,

If I remember the thread correctly look at:

 Perl-Style Pattern Extensions - User Manual p. 177

--
Best Regards,
Chris

-- 
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 with writing applescript for BBEdit

2011-09-02 Thread Christopher Stone
On Sep 02, 2011, at 13:05, Rick Yentzer wrote:
 I'm attempting to write an applescript that will automate some keystrokes.
 What I want to occur is when I'm inside a tag like so:
 taginsertion point/tag
 I want to be able to run the script to get the following format:
 tag
 
 insertion point
 
 /tag
 
 This part I have been able to accomplish. But how do I get it to see if the 
 tag is indented and if so, keep the insertion point and closing tag indented 
 as well?
__

Hey Rick,

I have not tested this thoroughly, but it seems to be working alright with 
indented and non-indented tags.

Note that I'm not testing for the presence of tags, so it will simply act on 
the line where the insertion point is regardless.

--
Best Regards,
Chris

__


tell application BBEdit
  try
tell text of front text document
  set start_Line to startLine of selection
  set bbFind to find ^\\s+ searching in line start_Line ¬
options {returning results:true, search mode:grep}
  if found of bbFind = true then
set indentSpace to found text of bbFind
  else
set indentSpace to 
  end if
  set iSpaceLen to length of indentSpace
  set text of selection to (return  indentSpace  tab  return  
indentSpace)
  set newInsertionPoint to (characterOffset of selection) + (length of 
selection) - 1 - iSpaceLen
  select insertion point before character newInsertionPoint
end tell

  on error errMsg number errNum
set sep to ==
set e to sep  return  Error:   errMsg  return  sep  return ¬
   Error Number:   errNum  return  sep
beep
display dialog e
  end try
end tell

-- 
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


[ANN] BBEdit 10.0.2 (3085) pre-release

2011-09-02 Thread Rich Siegel

Good { morning, afternoon, evening },

A new 10.0.2 pre-release build is now available.

Note that this is a _pre-release_ version. The intent is to fix 
bugs and address areas of improvement based on what our 
customers have reported. However, since the software is at this 
point not fully tested, there _may_ be bugs and regressions. If 
this prospect makes you nervous, then sticking with the public 
release versions is your best course of action. Nobody will be 
offended if you choose to do so; you're under no obligation to 
install and use anything but a public release. :-)


Following is a summary of the changes in the software since the 
last public release. The change notes are organized into 
additions, changes, and fixes, and are annotated where 
appropriate with case numbers. So if you recognize a number 
corresponding to a support case that was opened for you, you can 
now verify that it's been fixed correctly.


One final note: If you run into a bug in a pre-release version, 
PLEASE DO NOT REPORT THE BUG TO THE LIST. This includes asking 
about whether others have seen the same problem. Instead, please 
send a bug report to supp...@barebones.com and we will deal 
with it there. This will help us keep the list discussion on 
topic and productive for all list members.




version 10.0.2 (3085)   (9/2/2011)

Additions
-

o   (none in this build)

Changes
---

o   (none in this build)

Fixes
-

*   [NFR] Fixed bug in which live-matching in Open File by Name didn't
work correctly with instaprojects, or with projects 
containing items

that weren't readable with current permissions.

*   [NFR] The internal caching for instaprojects now resets if a folder
is modified in between invocations of the Open File by Name dialog.

*   [NFR] Fixed regression in which direct manipulation of the scroll
bar didn't cause lists to scroll.

*   [206950] Fixed crash which would occur when double-clicking 
in the

Recent Documents list to open a remote (FTP/SFTP) document.

*   [212909] Eliminated latency in enable/disable of markup tools
palette buttons, which would cause them to be disabled immediately
after window activations, which in turn led to them 
appearing to

ignore the first click.

*   [217897] Fixed bug in which compiled mach-o executables didn't
appear on the Apply Filters or Scripts menus.

*   Text completions that depend on examining the document's contents
(both for tokens in the document, and for possible 
completions from
the system spelling checker) are now skipped when the 
document is

above a certain size. The cutoff can be adjusted with an expert
preference:

`defaults write com.barebones.bbedit 
MaxDocumentLengthForCompletionTokenizer -int N`
`# N is an integer value, expressed in characters. The 
factory default is 1048576.`


=end=

The package can be downloaded from our web server:

http://pine.barebones.com/seeding/bbedit-1002_3085.dmg

Enjoy,

R.
--
Rich Siegel Bare Bones Software, Inc.
sie...@barebones.com  http://www.barebones.com/

Someday I'll look back on all this and laugh... until they 
sedate me.


--
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 with writing applescript for BBEdit

2011-09-02 Thread John Delacour

At 11:05 -0700 02/09/2011, Rick Yentzer wrote:


I'm attempting to write an applescript that will automate some keystrokes.

What I want to occur is when I'm inside a tag like so:

taginsertion point/tag

I want to be able to run the script to get the following format:

tag

insertion point

/tag

This part I have been able to accomplish. But how do I get it to see 
if the tag is indented and if so, keep the insertion point and 
closing tag indented as well?



These things are so much more easily done using text filters, which 
operate on the lines of the selection, unless there is none, in which 
case they operate on the whole text of the doc.


Here's how I would do it:


#! /usr/bin/perl
while () {
  $tabs = $1 if s~^(\t+)~~;
  s~([^]+) # opening tag = $1
  ([^]+) # enclosed text = $2
  ([^]+) # closing tag = $3.  Replace with:
  ~$tabs$1\n$tabs\t$2\n$tabs$3~x;
  print;
}

As you see, the skeleton of the script, and numberless similar scripts is:


while() {
  # substitutions, additions, deletions etc.
  print
}

If you can use regular expressions in BBEdit's find dialogue then you 
can use them in a Perl script and you can write such filters with 
practically no knowledge of Perl.  AppleScript sucks for such things. 
AppleScript is for user interaction and for doing things in the app 
that only Apple events can achieve.


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


TextExpander, BBEdit 10 and typing lag

2011-09-02 Thread Watts Martin
Just curious -- has anyone else noticed a definite typing slowdown in BBEdit 10 
with TextExpander enabled? I haven't noticed it consistently, but today things 
were very laggy in typing, and after trying a few different things -- removing 
a custom completion file I'd been playing with, doing the ol' Windows-esque 
trick of quitting and restarting everything -- I discovered that the lagginess 
largely went away when I disabled TextExpander.

It looks like even with TE turned off, BBEdit doesn't keep up if I'm just 
typing random letters as fast as I can, but it keeps up with my normal typing 
speed (mostly). With TE turned on, though, the lag is pretty visible. Programs 
using the native text controls (i.e., TextEdit) don't exhibit this.

This is with 10.0.2, builds 3081 and 3085.

-- 
Watts Martin lay...@gmail.com



smime.p7s
Description: S/MIME cryptographic signature