Re: Scripting search/replace

2011-08-23 Thread Christopher Stone
On Aug 22, 2011, at 17:20, verdonv wrote: After looking through the BBEdit script library, I realize the problem is that the 'replace' actually returns an integer that represents the number of instances of the pattern changed, and not the changed string. Right. I explained that already.

Re: Scripting search/replace

2011-08-23 Thread verdonv
Right.  I explained that already.  Perhaps my explanation wasn't clear? No it was fine. It just took a bit to sink in ;-) I also explained that the major problem remaining is that clippings EAT trailing whitespace even if they themselves CONTAIN whitespace.  That takes a little working

Re: Scripting search/replace

2011-08-23 Thread John Delacour
At 13:54 -0700 20/08/2011, verdonv wrote: Hi Chris, Thanks for the feedback and the example. I like the simpler pattern too :-) As to why I am activating it from a clipping, well because it is part of a bigger set of clippings. So far as I can see you can use shell scripts in clippings

Re: Scripting search/replace

2011-08-23 Thread John Delacour
At 09:03 -0400 20/08/2011, Verdon Vaillancourt wrote: I am writing a tiny applescript, that I invoke with a clipping, to do a search/replace on a string and return the string. I'm mostly there. My string might look like this... C EM Am7F The result looks like this... [C] [EM]

Re: Scripting search/replace

2011-08-22 Thread verdonv
After looking through the BBEdit script library, I realize the problem is that the 'replace' actually returns an integer that represents the number of instances of the pattern changed, and not the changed string. I know it seems silly, but given this, and the way that Clippings work, I think I'll

Scripting search/replace

2011-08-20 Thread Verdon Vaillancourt
Hi, I am writing a tiny applescript, that I invoke with a clipping, to do a search/replace on a string and return the string. I'm mostly there. My string might look like this... C EM Am7F The result looks like this... [C] [EM] [Am7][F] My script looks like this... tell

Re: Scripting search/replace

2011-08-20 Thread Christopher Stone
On Aug 20, 2011, at 08:03, Verdon Vaillancourt wrote: I am writing a tiny applescript, that I invoke with a clipping, to do a search/replace on a string and return the string. I'm mostly there. __ Hey Verdon, Any special

Re: Scripting search/replace

2011-08-20 Thread verdonv
Hi Chris, Thanks for the feedback and the example. I like the simpler pattern too :-) As to why I am activating it from a clipping, well because it is part of a bigger set of clippings. Clippings are the sensible method for most of the set. This one is the oddball, but I want to keep everything

Re: Scripting search/replace

2011-08-20 Thread Christopher Stone
On Aug 20, 2011, at 15:54, verdonv wrote: Thanks for the feedback and the example. I like the simpler pattern too :-) __ Hey Verdon, You bet. As to why I am activating it from a clipping, well because it is part of a bigger

Re: Scripting search/replace

2011-08-20 Thread verdonv
Yes, that's the sort of direction I was trying to go with the 'as alias' thing... My thoughts, a) create a string from the contents of the selection, b) run the replace on the string, c) return the string, which the clipping will replace the original selection with... I just don't know much about