AppleScripting a BBEdit Find...

2023-08-29 Thread Christian Boyce
I have a simple Find in a BBEdit AppleScript. It looks like this:

set myList to find "^DESC!([A-Z]*[0-9]*)\\t(INT\\.|EXT\\.{1})(.*)$" 
searching in text 1 of text of myDoc options {search mode:grep, starting at 
top:true, returning results:true}


The very last part of this statement, where it says “returning results:true” is 
important because I need the list of what is found (I later step through the 
list of found items). 

If I say “returning results: false” I don’t get the list of found items, so I 
can’t step through them later. I have to have “returning results: true”. 

But… if it happens that NOTHING is found, which is bound to happen, then I get 
a little notification from BBEdit saying “Multi-File Search Completed. The 
pattern "^DESC!([A-Z]*[0-9]*)\t(INT\.|EXT\.{1})(.*)$” was not found.”

I would rather not see that little notification. Is there a way, in 
AppleScript, to tell that notification to not appear?

Thank you--

-- 
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/8B4E2A94-75EC-4A2A-8884-D9FBB41EC4A6%40christianboyce.com.


Re: Appending to a line

2022-05-10 Thread Christian Boyce
Great explanation Bucky— I shouldn’t have been so lazy as to not give an 
explanation myself! Thanks for doing what I should have done. It’s perfect.

> On May 8, 2022, at 8:13 PM, Bucky Junior  wrote:
> 
> I was fortunate to learn some bits of regex/grep from helpful people on this 
> list who not only showed an answer to a question but explained what was 
> happening. While this search/replace using grep is quite simple, it’s not 
> always obvious to everyone.
> 
> 
>> On May 8, 2022, at 1:36 PM, Dave Simpson > > wrote:
>> 
>> You want to do a GREP search, with search string like this:
>> 
>> ^(2 PLAC)(.*)$
>> 
>> And you want to replace with this:
>> 
>> \1\2 England
>> 
>> That’s it. Try it.
>> 
> 
> In the search pattern:
> ^ means start at the beginning of a line
> (2 PLAC) parentheses bracket the search text and “remembers" it. In this 
> case, it is known characters. Grep lets you search for unknown/partially 
> known characters too.
> (.*) second parentheses uses “.” As any character except newline or carriage 
> return. The asterisk expands that to zero or more characters.
> $ means the end of the line.
> 
> The replacement is
> \1 first parentheses “remembered” pattern
> \2 follow that with the second
> England end the replacement with a space and then the literal text “England”
> 
> That’s mostly this grep/replace. You know the BBEdit Manual has lots more.
> Bucky

-- 
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/A254A9AE-ADD7-4353-A268-18E709817BDF%40christianboyce.com.


Re: Appending to a line

2022-05-08 Thread Christian Boyce
This GREP stuff is really worth learning. 

However, I can help you with this particular problem, because it’s easy.

You want to do a GREP search, with search string like this:

^(2 PLAC)(.*)$

And you want to replace with this:

\1\2 England

That’s it. Try it.

> On May 8, 2022, at 8:53 AM, Dave Simpson  wrote:
> 
> I've looked at Creating Subpatterns in then manual but I'm sorry but a lot of 
> the syntax is going over my head :-(
> 
> I'm not a power user and generally just need to do straightforward 
> search/replace.
> 
> I want to search a text file.
> Every time a line begins 2 PLAC
> I want to append the word England to the end of the line.
> 
> Hope someone can help
> 
> -- 
> 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/39d3f39e-7a63-4952-8593-a9240f0da066n%40googlegroups.com
>  
> .

—


• How to use Widgets in iOS 15 


‌

-- 
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/691F7910-04FA-4F94-BE75-CCB93F37F441%40christianboyce.com.


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

2021-03-20 Thread Christian Boyce
You asked for GREP, and this isn’t GREP, but it still solves your problem. I 
used AppleScript. 

Note: this script is written in order to be as easy to follow as possible. It 
could be improved of course. 

Basically I’m going down your document a line at a time, comparing what’s on 
the left side of the tab to the value that was in Column One the last time it 
changed. If it’s the same as that, I don’t write it— I just write tab and 
Column Two to a variable called newText. If it’s different, I write Column One 
and Column Two to newText. Finally I set the text of the document to the 
contents of the variable newText.

Watch out fo the line that sets AppleScript’s text item delimiters to a tab. 
The line actually looks like this before compiling:

set AppleScript's text item delimiters to {"\t”}

But when you compile the slash-t is changed to a tab, which is invisible. 

--

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "BBEdit"
set myDoc to document 1
set originalText to text of myDoc
set newText to ""
set ColumnOne to ""
set ColumnTwo to ""
--
set theParagraphs to paragraphs of originalText as list
repeat with aParagraph in theParagraphs
set saveTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"“}— that’s a 
tab in there— you can’t tell but it is. Use “\t” as I’ve written 
— on the next line
--  set AppleScript's text item delimiters to {"\t”}— commented out so you 
can see how it looks before compiling

set thisColumnOne to text item 1 of aParagraph
set thisColumnTwo to text item 2 of aParagraph
if thisColumnOne is ColumnOne then
set thisOutput to tab & thisColumnTwo & return
else
set thisOutput to thisColumnOne & tab & thisColumnTwo & 
return
set ColumnOne to thisColumnOne
end if
set newText to newText & thisOutput
end repeat
set AppleScript's text item delimiters to saveTID
set text of myDoc to newText
end tell

> On Mar 20, 2021, at 4:30 AM, samar  wrote:
> 
> Hi
> 
> This is the first time a post a message here.
> 
> 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, each line has two elements (represented here by A\d and B\d) 
> separated by one tab character. The length of the two elements is between 1 
> and 100 characters each.
> 
> Now I need a GREP Find/Replace string to make it look like this:
> 
> 
> 
> 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.
> 
> Sounds simple. And yet all I manage to GREP for is this:
> 
> 
> The result looks promising but in now way satisfactory:
> 
> 
> 
> The tab characters are inserted correctly, but the problem has to do with 
> repetition ... Does anyone see how this can be resolved?
> 
> Thanks
> samar
> 
> 

—

Socially distantly yours,

Christian Boyce

-- 
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: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2441499A-F563-4AF4-B63C-8B5B9B5B47DC%40christianboyce.com.


Re: Reverse order of lines

2021-03-08 Thread Christian Boyce
You can do it in AppleScript, operating on selected text in BBEdit if you want. 
This isn’t the one-liner that the Unix people are giving you but it still works:

tell application "BBEdit"
set myDoc to document 1
set mySelection to the selection
set theList to contents of lines of mySelection

set newOrder to ""

repeat with aParagraph in theList
set newOrder to aParagraph & return & newOrder
end repeat
set selection to newOrder
end tell



> On Mar 8, 2021, at 9:14 AM, Ted Stresen-Reuter  wrote:
> 
> Hi,
> 
> I know this can be done but am not finding the solution.
> 
> Given:
> 
> Lingo (Macromedia Director)
> AppleScript
> HyperTalk
> HTML
> JavaScript
> Perl
> SQL
> Bash
> HTTP
> PHP
> CSS
> Visual Basic
> ASP (Classic)
> XML
> XSLT
> jQuery
> Fusebox for PHP
> WordPress
> Laravel
> React
> AlpineJS
> 
> I'd like to end up with a list with the items in the reverse order, so, along 
> the lines of:
> 
> AlpineJS
> React
> Laravel
> WordPress
> Fusebox for PHP
> etc.
> 
> Note that the sort criteria is the order the lines appear in in the input. 
> Can't BBEdit do this?
> 
> Thanks in advance.
> 
> Ted Stresen-Reuter
> 
> -- 
> 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/CAKAQjifrOD%3DkExWSCng3LHxaVVmWoaRJgFLeWf6j5fSnM7WqUQ%40mail.gmail.com
>  
> .

—

Socially distantly yours,

‌ ‌

Check out our latest blog posts!

‌• How to make and use Shortcuts in iOS 


• How to get your AOL email working again on your iPhone, iPad, and Mac 


• Can’t send mail from Mac Mail app? Here’s a fix. 


• One-handed quick-swipe method for deleting email on an iPhone 


• How to opt in to the COVID-19 Exposure Notification Express system on an 
iPhone 


• How to use Widgets in iOS 14 


• Change the way thumbnails look in the iOS Photos app 


‌

-- 
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/0A6DB43C-D01B-4FE0-A209-A2431D2FDCD9%40christianboyce.com.


Re: select entire line(s) and extract them

2020-12-17 Thread Christian Boyce
If I understand what you’re saying, you have a document with contents that 
looks like this:

Line 1
Line 2
Line 3
This is Line 4

Etc.

If that’s so, this AppleScript should do it:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "BBEdit"
set theDocument to document 1
set theContent to contents of theDocument
set theText to text of theContent
set theParagraphs to every paragraph of theText
repeat with aParagraph in theParagraphs
set myNewDocument to make new document
set contents of myNewDocument to text of aParagraph
end repeat
end tell


It’s possible to make this a shorter script but written this way it’s easier to 
understand.

c
> On Dec 17, 2020, at 6:07 AM, Gabriel  wrote:
> 
> Hi, 
> I just discovered BBEdit.
> I'm trying to do something about it:
> From a text document that contains n lines, select the first whole line, copy 
> it into a new document, then the next one, until the end of the document (if 
> I have 50 lines, I would have 50 new text files). 
> I started to explore the possibilities of "grep", with these commands: 
> ^.*
> But I can't get the selection to stop at the end of the line, despite many 
> tries.
> (I'd like to point out that I don't know anything about these code systems!)
> Ideally I'd like to be able to save these documents with the content of the 
> line itself as filename, but let's say it's a second step (and I don't even 
> know if it's possible). 
> Thanks for the help!
> 
> -- 
> 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/77232728-9b03-48d1-9988-74fc67d37005n%40googlegroups.com
>  
> .

-- 
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/2859A09D-EC52-4ADD-85E4-4E50371E6A94%40christianboyce.com.


Re: Regex help - matching unique URLs and deleting HTML encoding

2020-01-26 Thread Christian Boyce
Hi Iain:

This works (maybe not the cleanest way but it works):

Search for this:

((.*)()

Replace with this:

\3



> On Jan 26, 2020, at 3:30 PM, Sammy Banawan  wrote:
> 
> I have  href="https://www.facebook.com/somename1?fref=profile_friend_listhc_location=profile_browser
>  
> <https://www.facebook.com/somename1?fref=profile_friend_listhc_location=profile_browser>"
>  
> data-gt="{engagement:{eng_type:1,eng_src:2,eng_tid:10180221704,eng_data:[]}}"
>  
> data-hovercard="/ajax/hovercard/user.php?id=10180221704extragetparams=%7B%22hc_location%22%3A%22profile_browser%22%7D"
>  data-hovercard-prefer-more-content-show="1">Some Name 1
> 
> and I just want to keep Some Name 1. The HTML I want to strip entirely.
> 
> Obviously, the file has 
>  href="https://www.facebook.com/somename2?fref=profile_friend_listhc_location=profile_browser
>  
> <https://www.facebook.com/somename2?fref=profile_friend_listhc_location=profile_browser>"
>  
> data-gt="{engagement:{eng_type:1,eng_src:2,eng_tid:10180221704,eng_data:[]}}"
>  
> data-hovercard="/ajax/hovercard/user.php?id=10180221704extragetparams=%7B%22hc_location%22%3A%22profile_browser%22%7D"
>  data-hovercard-prefer-more-content-show="1">Some Name 2
> 
> etc. as well.
> 
> I can't figure out the regex pattern for this. Any help would be appreciated. 


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text. We're old-fashioned that way.

Read our latest blog post: ‌How to rearrange the order of menubar icons on a 
Mac <https://oneminutemacman.com/rearrange-menubar-icons-mac/>‌

Current location and temperature: ‌‌‌
San Antonio, United States: ☀️ +59°F
‌

-- 
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: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B5579154-AA79-4AA8-95C1-1A6CD96CCAC7%40christianboyce.com.


Re: Applescript needed to break a text line into components

2020-01-03 Thread Christian Boyce
Howdy. As far as I'm concerned, your post is totally appropriate. AppleScript 
is something that really leverages BBEdit's powers.

Here is a script that does what you want. It assumes the document has some text 
like what you have as an example. One could add a check to make sure there was 
a match.

I am guessing that the comma after "Aircraft" in the result is a typo.

Anyhow, here's a script. Contact me if you need more help.

--
--  Created by: Christian Boyce
--  Created on: 1/3/20
--
--  Copyright (c) 2020 Christian Boyce and Associates
--  All Rights Reserved
--

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "BBEdit"
set myDocument to document 1
set NewText to my Fixed_Text(myDocument)
end tell

on Fixed_Text(myDocument)
tell application "BBEdit"

-- first we break the text into paragraphs
set SearchString to "(\\$\\$.*) (\\[)See (.+)]"
set ReplaceString to "\\1\\n\\2See\\n\\3]"
tell myDocument
set myResult to find SearchString options {search 
mode:grep, starting at top:true} with selecting match
set text of found object of myResult to (grep 
substitution of ReplaceString)
end tell

-- store the parts for future assembly
set fixedText to the selection as string
set firstParagraph to paragraph 1 of fixedText
set secondParagraph to paragraph 2 of fixedText

-- clean off the last character of paragraph 3
set LastParagraph to paragraph 3 of fixedText
set LastParagraph to characters 1 through -2 of LastParagraph 
as string

-- change comma-separated list to return-separated list
set AppleScript's text item delimiters to ", "
set stackedParagraphs to text items of LastParagraph as list

-- Careful here-- the following line ends with backslash n.
set AppleScript's text item delimiters to "
" -- this is tricky-- it is typed as "backslash n" but it is compiled to a 
return, which you can't see.
set LastParagraph to stackedParagraphs as string
set AppleScript's text item delimiters to "" -- default

-- assemble the text
set final_result to firstParagraph & return & secondParagraph & 
return & LastParagraph & return & "]"
set selection to final_result
end tell
end Fixed_Text
> On Jan 3, 2020, at 7:04 AM, 1611mac <1611...@gmail.com> wrote:
> 
> I've used BBedit for year but new to forum.  Is it appropriate to post bbedit 
> AppleScript needs here?  (or help?)
> 
> I need a script to take a text line such as this:
> 
> $$FIXED WING [See Aircraft, Cessna 150, Antique Airplanes, Airflow]
> 
> and place on separate lines as:
> 
> $$FIXED WING
> [See
> Aircraft,
> Cessna 150
> Antique Airplanes
> Airflow
> ]
> 
> Any assistance is much appreciated.   THANKS for looking!  
> 
> -- 
> 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 to the group.
> Follow @bbedit on Twitter: <https://twitter.com/bbedit 
> <https://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 
> <mailto:bbedit+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/0612001f-e685-4595-b998-b46edd43ef2e%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/0612001f-e685-4595-b998-b46edd43ef2e%40googlegroups.com?utm_medium=email_source=footer>.


--
Christian Boyce

‌

-- 
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 to the group.
Follow @bbedit on Twitter: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/279433BA-500C-45A6-BD9E-5C9B83685D10%40christianboyce.com.


Re: Automation question

2019-09-21 Thread Christian Boyce
Well how about that: I figured out how to answer my own question. In case 
you're interested, here's how I did it.

The key is to realize that I can find the text surrounded by a known set of 
tags using a grep search, with the option "selecting match" turned on, and with 
the "starting at top" option also turned on. This means I can run a script to 
automatically find text surrounded by certain tag, and more importantly SELECT 
that text. My other scripts (UPPERCASE.scpt and lowercase.scpt) work on the 
selected text. The first time through the loop, I get the first "find" result, 
the result is selected, and the proper script (UPPERCASE.scpt or 
lowercase.scpt) operates on that. The next time through the loop, it finds the 
second "find" result (because the first one isn't there anymore— it's been 
changed), and the result is selected, and the proper script is called… etc. 

Obviously the way I've done it ("repeat 100 times") is a little crude, but it 
works. I could figure out how many instances of each script tag is in the 
document, and only loop that many times, but this is so fast already that I 
don't mind the inefficiency. I'll fix that up later. 

Anyway, here's what I came up with. Might help someone else. The key take-aways 
are the "with selecting match" and "starting at top." 

tell application "BBEdit"
set SearchStringOne to "{Script_One}\\n(.*)\\n{/Script_One}"
set ReplaceStringOne to "\\1"
--
set SearchStringTwo to "{Script_Two}\\n(.*)\\n{/Script_Two}"
set ReplaceStringTwo to "\\1"
set myDocument to document 1
tell myDocument
repeat 100 times
set myResult to find SearchStringOne options {search 
mode:grep, starting at top:true} with selecting match
if (found of result) then
set text of found object of myResult to grep 
substitution of ReplaceStringOne
tell script "UPPERCASE.scpt"
UPPERCASE(myDocument)— for 
demonstration purposes, this script turns text to all UPPERCASE
end tell
end if
--
set myResult to find SearchStringTwo options {search 
mode:grep, starting at top:true} with selecting match
if (found of result) then
set text of found object of myResult to grep 
substitution of ReplaceStringTwo
tell script "lowercase.scpt"
lowercase(myDocument)— for 
demonstration purposes, this script turns text to all lowercase.
    end tell
end if
end repeat
end tell
end tell

> On Sep 20, 2019, at 3:18 PM, Christian Boyce  
> wrote:
> 
> I have a BBEdit document looking something like this:
> 
> {Tag_A}
> Some text, could be multiple sentences, multiple paragraphs.
> {/Tag_A}
> 
> Some other text here
> 
> {Tag_B}
> More text here. Could be multiple sentences, multiple paragraphs, as above.
> {/Tag_B}
> 
> {Tag_A}
> Some text, could be multiple sentences, multiple paragraphs.
> {/Tag_A}
> 
> Some other text here
> 
> {Tag_B}
> More text here. Could be multiple sentences, multiple paragraphs, as above.
> {/Tag_B}
> 
> Etc.
> 
> I have two AppleScripts which currently work on whatever text it selected. 
> For purposes of this discussion let's say I have Script A which applies some 
> custom capitalization, and Script B that wraps certain words in 
>  tags. 
> 
> The scripts work great as long as I select, by hand, the text I want to work 
> with. At the end of the script, after I have done the operations I want to 
> do, I set the selection to the newly computed text. 
> 
> The way it SEEMS to work is the selected text stays selected the whole time, 
> and at the very end I am writing into the selection. It is as if I pasted a 
> result into a selection— the selected text is replaced with what I pasted.
> 
> What I'm trying to do is automate the selections. That is, in the example 
> above, I want to (somehow) automatically select everything between the first 
> set of {Tag_A}{/Tag_A} tags, and run Script A on it. Then I want to (somehow) 
> automatically select everything between the first {Tag_B}{/Tag_B} tags, and 
> run Script B. Then I want to select the text between the next set of A tags 
> and run Script A, and then select the text between the next set of B tags and 
> run Script B, and so on.
> 
> Any suggestions? What I'm describing is sort of an invisible hand that makes 
> the sele

Automation question

2019-09-20 Thread Christian Boyce
I have a BBEdit document looking something like this:

{Tag_A}
Some text, could be multiple sentences, multiple paragraphs.
{/Tag_A}

Some other text here

{Tag_B}
More text here. Could be multiple sentences, multiple paragraphs, as above.
{/Tag_B}

{Tag_A}
Some text, could be multiple sentences, multiple paragraphs.
{/Tag_A}

Some other text here

{Tag_B}
More text here. Could be multiple sentences, multiple paragraphs, as above.
{/Tag_B}

Etc.

I have two AppleScripts which currently work on whatever text it selected. For 
purposes of this discussion let's say I have Script A which applies some custom 
capitalization, and Script B that wraps certain words in  
tags. 

The scripts work great as long as I select, by hand, the text I want to work 
with. At the end of the script, after I have done the operations I want to do, 
I set the selection to the newly computed text. 

The way it SEEMS to work is the selected text stays selected the whole time, 
and at the very end I am writing into the selection. It is as if I pasted a 
result into a selection— the selected text is replaced with what I pasted.

What I'm trying to do is automate the selections. That is, in the example 
above, I want to (somehow) automatically select everything between the first 
set of {Tag_A}{/Tag_A} tags, and run Script A on it. Then I want to (somehow) 
automatically select everything between the first {Tag_B}{/Tag_B} tags, and run 
Script B. Then I want to select the text between the next set of A tags and run 
Script A, and then select the text between the next set of B tags and run 
Script B, and so on.

Any suggestions? What I'm describing is sort of an invisible hand that makes 
the selections for me. There might be a better way to do it so I am open to 
suggestions!

I don't have any trouble with the Scripts A and B. Those are fine. What I need 
is a way to tell BBEdit to select the right chunks of text to apply these 
scripts to.

THANK YOU—

Christian Boyce

-- 
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 to the group.
Follow @bbedit on Twitter: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2C08A6D3-BA5F-41B8-A8DF-3ED3DF64E66C%40christianboyce.com.


Re: Tweaking BBedit to Be Less Daunting to Writers

2019-04-07 Thread Christian Boyce
An AppleScript to make these changes (and another to change them back) would be 
nice. I’ll look into it unless someone’s done it already. 



--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text.

Read our latest newsletter: ‌How to make Evernote stop opening every time you 
start your Mac‌

Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! https://www.facebook.com/christianboyce.and.associates


> On Apr 7, 2019, at 9:52 AM, Jim Leff  wrote:
> 
> Know anyone who'd like using BBEdit but finds it too geeky? The following 
> pref tweaks make BBEdit friendly to writers, yielding a familiar plain 
> rectangle for new docs and a less cluttered look for those accustomed to word 
> processors (whose WYSIWYG approach is getting as archaic as steam engines).
> 
> I'd always used BBEdit for web dev, and sometimes for blog posts, but these 
> tweaks left me with an app I can live for all writing tasks (exception: book 
> publishers still need DOCX files).
> 
> 
> ==
> *Prefs: Appearance* 
> 
> Deselect line numbers and gutter 
> 
> 
> *Prefs: Application* 
> 
> Deselect “Always Show Full Paths in Open Recent Menu 
> Select “When Bbedit Becomes Active, New Text Document” 
> 
> 
> *Prefs: Editing* 
> 
> "Show Text Completions Only Manually" 
> Deselect “Display Instances of Selected Text 
> 
> 
> *Prefs: Editor Defaults* 
> 
> Select “Softwrap Text to: Character Width: 80 
> Default Font: I like Optima Regular 14 
> 
> 
> *Prefs: Printing* 
> 
> Deselect “Print Page Headers” 
> Deselect “Print Full Pathname” 
> Deselect “Print Line Numbers” 
> Deselect “Print Color Syntax” 
> Unfortunately, we’re stuck with either time stamp or "date saved" stamp 
> 
> 
> *Prefs: Text Files* 
> 
> Select "Make Backup Before Saving" 
> Select "Keep Historical Backgrounds" 
> 
> 
> *Prefs: menus and shortcuts* 
> 
> Choose "Simple Menus" (button at lower left) 
> Deselect #!, 
> 
> 
> *View Menu* 
> 
> Hide Navigation Bar 
> Text Display: Hide Page Guide  
> Text Display: Hide Gutter 
> -- 
> 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 to the group.
> Follow @bbedit on Twitter: <https://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.
> Visit this group at https://groups.google.com/group/bbedit.

-- 
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 to the group.
Follow @bbedit on Twitter: <https://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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Applescript to replace selected text only using grep pattern

2018-10-20 Thread Christian Boyce
Wow, Chris, that's much better. Thank you.

C

> On Oct 19, 2018, at 3:37 PM, Christopher Stone  <mailto:listmeis...@suddenlink.net>> wrote:
> 
> 
> Hey Christian,
> 
> That can be simplified a bit.  :)
> 
> tell application "BBEdit"
> tell selection to replace using "calc(" & its text & " * .625)" options 
> {search mode:grep, starting at top:true}
> end tell
> 
> --
> Take Care,
> Chris


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text.

New! How to remove adware and malware from your Mac 
<https://christianboyce.com/how-to-remove-adware-and-malware-from-your-mac/>‌

Follow us on Twitter! http://twitter.com/christianboyce 
<http://twitter.com/christianboyce>
Be a fan on Facebook! https://www.facebook.com/christianboyce.and.associates 
<https://www.facebook.com/christianboyce.and.associates>

-- 
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 to the group.
Follow @bbedit on Twitter: <https://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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Applescript to replace selected text only using grep pattern

2018-10-14 Thread Christian Boyce
I know you already have an answer but I think it's good to know how to restrict 
an AppleScript "replace" in BBEdit to the selected text. I had this problem 
myself once.

This is how I'd do it (and it works!)

tell application "BBEdit"
set myDocument to document 1
set selectedText to the selection as string
replace selectedText using "calc(" & selectedText & " * .625)" 
searching in selection of text window 1 of myDocument options {search 
mode:grep, starting at top:true}
end tell



> On Oct 14, 2018, at 12:56 AM, Kevin Bolduan  wrote:
> 
> I'd like to have a keyboard shortcut that allows me to highlight a selection 
> and have it be replaced using a grep pattern that uses the selection. I'm 
> writing some CSS and I need to convert various font-size declarations as 
> follows:
> 
> 2rem ->  calc(2rem * .625)
> 
> I can't do a global search-and-replace and would like a quick and easy way to 
> type "2rem" (or any other value), select it, press the keyboard shortcut, and 
> have it change to calc(2rem * .625).
> 
> I cobbled together the following AppleScript:
> 
> tell application "BBEdit"
>   set selectedText to contents of selection
>   replace selectedText using "calc(" & selectedText & " * .625)" 
> searching in text 1 of front text document options {search mode:grep, 
> starting at top:true}
> end tell
> 
> but it has a few flaws. The first is that according to the Applescript 
> dictionary for BBEdit, "replace" is actually Replace All, which I don't want; 
> I only want it to replace what I've selected.
> 
> replace v : performs a Replace All
> 
> And second, the Search Options seem to leave out the "Selected text only" 
> option that lives in the Find/Replace dialog box; they have everything else:
> 
> SeSearch Options n : Options for “find” and “replace” commands
> 
> properties
> 
> search mode (literal/‌grep) : the type of search (literal search if omitted)
> 
> starting at top (boolean) : start from the top of the document? (false if 
> omitted)
> 
> wrap around (boolean) : should the search wrap from the end of the document? 
> (false if omitted)
> 
> backwards (boolean) : should the search proceed backwards? (false if omitted)
> 
> case sensitive (boolean) : should the search be case-sensitive? (false if 
> omitted)
> 
> match words (boolean) : should the search only find whole words? (false if 
> omitted)
> 
> extend selection (boolean) : should the selection range include the original 
> selection start through the end of the match? (false if omitted)
> 
> 
> Any suggestions on how to limit the scope of the script to JUST the 
> selection, would be appreciated!
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com <mailto:supp...@barebones.com>" rather than posting to 
> the group.
> Follow @bbedit on Twitter: <https://www.twitter.com/bbedit 
> <https://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 
> <mailto:bbedit+unsubscr...@googlegroups.com>.
> To post to this group, send email to bbedit@googlegroups.com 
> <mailto:bbedit@googlegroups.com>.
> Visit this group at https://groups.google.com/group/bbedit 
> <https://groups.google.com/group/bbedit>.


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text.

New! https://christianboyce.com/how-to-remove-adware-and-malware-from-your-mac/

Follow us on Twitter! http://twitter.com/christianboyce 
<http://twitter.com/christianboyce>
Be a fan on Facebook! https://www.facebook.com/christianboyce.and.associates 
<https://www.facebook.com/christianboyce.and.associates>

-- 
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 to the group.
Follow @bbedit on Twitter: <https://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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Upgrading and Apple Scripts

2017-09-19 Thread Christian Boyce
In my experience, the only AppleScript thing that changed between 9 and 11 had 
to do with the target of the search and replace. This was a problem for me in 
moving from 10 to 11. For example:

tell application "BBEdit 10"
set the_Text to the selection
set find_string to "this"
set replace_string to "that"
tell the_Text
replace find_string using replace_string options {starting at 
top:false, wrap around:false, backwards:false, case sensitive:false, match 
words:false, extend selection:false}
end tell
end tell

If I have a document full of the word "this" and I select part of the document, 
and I run the script, it changes only the part that is selected. That is what I 
expected since I said "tell the_Text." The AppleScript dictionary for BBEdit 10 
documents that--

searching inoptionalanything   where to 
replace the string (defaults to the tell-target of the event)


But... if I run the same script against the same text file in BBEdit 11.5.3, it 
changes every instance of "this" starting in the_Text but also continuing to 
the end of the document.

The extend selection option is supposed to be false if omitted, but whether I 
omit it or specify "false" the replacing continues to the end of the document.

I noticed this because one of my customers uses a script that is applied to a 
selected range of text, but they saw it make changes all the way to the end of 
the document. It worked for years but broke in version 11.x. They are on 11.5.3 
and so am I, downloaded directly from barebones.com .

***

I contacted Bare Bones tech support about this and received this message, which 
explained what was going on:

> First, please note that per BBEdit 11's scripting dictionary, many of the 
> options you mention from BBEdit 10 are no longer applicable.
> 
> In addition, the behavior of the 'replace' command is now consistent with 
> that of the GUI "Replace All" command, in that both commands replace _all 
> actual_ instances present in the document irrespective of the insertion 
> point's position or the active selection range (unless explicitly targeted).
> 
> Next, if you want a script to operate upon the selected text only, then you 
> must explicitly specify that text as the target of the operation, e.g.
> 
> tell application "BBEdit"
>set find_string to "this"
>set replace_string to "that"
>   
>replace find_string using replace_string searching in selection of text 
> window 1
> end tell
> 
> and this same construction should also work with BBEdit 10.


***

There may be other differences between 9 and the current version but for sure, 
watch out for "tell the selection" because it does not do what it used to. It's 
not as if it's a problem. You just have to change the way your write the script.

c
> On Sep 19, 2017, at 12:33 PM, Chuck Dingee  > wrote:
> 
> I have been using BBEdit for many years, and it has been quite a few since I 
> have upgraded. I am using version 9.6.3 (ancient, I know). I love it, and I 
> figure if it ain't broke don't fix it. But I am thinking of upgrading now and 
> want to make sure my old Apple Scripts will work. (Obviously I would need to 
> tweak them, but do I need to start from scratch?)
> Thanks!

-- 
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: 
--- 
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Control-drag to duplicate

2017-04-25 Thread Christian Boyce
Try the Option key.
> On Apr 24, 2017, at 1:43 PM, Irl <opticsm...@mindspring.com 
> <mailto:opticsm...@mindspring.com>> wrote:
> 
> In some text editors (Word 2011, in particular), highlighting a selection, 
> clicking on it, pressing and holding the control key, then dragging, will 
> create a copy and place it where the cursor is when the mouse button is 
> released. I can't make this happen in BBEdit. Does the feature exist 
> somewhere, What I want to do is select, the copy and paste elsewhere, without 
> using the clipboard (which already has something on it). Yes, I know there 
> are multiple clipboards but I haven't learned how to use them and this is a 
> nice method if it works.


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

-- 
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Need help with AppleScript that converts a selected string of words to "Title Case"

2015-10-21 Thread Christian Boyce
Hi Michelle. I did this a few years ago and modified it a few times too. You 
will find an array of words that you want to keep lowercase in the script— 
first you see the array capitalized, then you see it lowercase (the way you 
want it).

I found, after using my original script, that there were exceptions: words like 
“MacBook” and “iPhone” and “iTunes” needed to stay capitalized as they are. I 
made a list of words like those and put them in a text file. You would do this 
too. The name of the file doesn’t matter as it will be stored as a property. 
Next time you run the script, it will not ask you to locate the file as it will 
already know where it is. You can edit that file as time goes by— easier than 
editing the script since it’s just a list of words. You could delete this 
section of the script of course.

I also found that even though you don’t want to capitalize words like “a” and 
“an” you might need to anyway. For example, if you have a sentence like “A 
horse is not a good house pet” you want the first “a” to be capitalized and the 
second “a” not to be. So I added code to test whether I was leading a sentence 
with one of those words. You could throw this part of the script out too.

I also found that I was messing up URLs. Some are case-sensitive. So, if it’s a 
URL, I save it and put it back. In my case I knew that the URL would be on a 
line by itself, so I test for that. This should be generalized but I didn’t do 
it.

I also set this script up to allow you to display a dialog box asking whether 
you want to use the regular Change Case box or this new one. But it is 
commented out here. 

Hoping this helps and makes sense. Here’s the script.

property the_file : ""
--If there is no value for "the_file" there will be the next time you run the 
script.
-- by Christian Boyce, mac...@christianboyce.com, www.christianboyce.com
-- Using "grep" throughout.
-- February 18th, 2011. Corrected Step 2 for single-quotes. 
-- Revised June 4th, 2011. Changed initial case change step to better method.
-- Revised again June 22nd, 2011. Was making errors by mistakenly affecting 
URLs. 
-- Revised/corrected June 24th, 2011 to catch case where there aren't any links.
-- Created new method in which lines that begin with "http" are stored, and 
later put back into the changed text. Much more efficient than working line by 
line. Other speed improvements also. 
--
--This script, with the "on run {} and "end run" wrapper, works when it is
--in the Menu Scripts folder, inside the BBEdit folder, inside the Application 
Support folder,
--in your user Library ("~/Library/Application Support/BBEdit/Menu Scripts/").
--
--The script gives the option of using the original Change Case command.
(*
-- we would use this On Run handler if we put the script into the Menu Scripts 
folder.
--
on run
-- The run handler is called when the script is invoked normally,
-- such as from BBEdit's Scripts menu.
changecaseformichelle()
end run
*)
--
(*
--commented out because we are not going to attach to a menu item after all
on menuselect()
-- The menuselect() handler gets called when the script is invoked
-- by BBEdit as a menu script.
-- true means we do the changecaseformichelle script instead of the 
normal command
-- false means we do the normal command
--
set the_status to changecaseformichelle()
return the_status
end menuselect
*)
--
-- this would be called "on changecaseformichelle() if we wanted to put this in 
the Menu Scripts folder.
on run {}
(*
-- User gets to choose whether to use standard Change Case or this 
modified version. Added 2-14-2011. Happy Valentine's Day.
set the_button to display dialog "Would you like to use the standard 
Change Case, or Michelle's version?" buttons {"Standard", "Michelle's"} default 
button "Michelle's"
*)
--set the_button to button returned of the_button-- as if it had been 
clicked.
set the_button to "Michelle's"

if the_button is "Michelle's" then
set the_exceptions_upper to {"A", "An", "And", "As", "At", 
"But", "By", "For", "From", "In", "Into", "It", "Nor", "Of", "On", "Onto", 
"Or", "so", "The", "To", "with"}
set the_exceptions_lower to {"a", "an", "and", "as", "at", 
"but", "by", "for", "from", "in", "into", "it", "nor", "of", "on", "onto", 
"or", &qu

Re: Insertion inside empty comments

2013-05-09 Thread Christian Boyce
Could you do it with the help of Typinator or Text Expander? Both of those let 
you set the insertion point. 

c
On May 9, 2013, at 4:00 AM, Riccardo Perotti pero...@pobox.com wrote:

 I used to be able to hit Un/Comment Selection in an EMPTY selection and get 
 an empty comment with the insertion point *INSIDE* not after it:
 
 WANT:
 !-- #insertion# --
 /* #insertion# */
  
 
 GET:
 !--   -- #insertion#
 /*  */ #insertion#
 
 
 This used to work not that many major versions ago. It seems that there's a 
 good number of people wanting this behavior back, but I have not been able to 
 find an answer or solution, nor any mention of it in the expert preferences.
 
 Currently using 10.5.3 (3280) with expert prefs:
 % defaults read com.barebones.bbedit CommentWholeLineWithInsertionPoint
 % 0
 % defaults read com.barebones.bbedit PreferLineCommentsWhenCommenting
 % 0
 
 Please help!
 
 -- 
 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.
  
  


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
New Main Phone Number: 424-354-3548

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! 
https://www.facebook.com/pages/Christian-Boyce-and-Associates/98451972202

Now Playing on The Boyce Blog: Can't Add a Printer? Reset the Printing System

Partly Cloudy, 59 F in Santa Monica, California

-- 
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.8.1 Disabled my BBEdit

2012-08-28 Thread Christian Boyce
I wonder whether your apps are where the system expects them to be 
(Applications folder). Also, how do you launch them, and what happens when you 
try?

--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
New main phone number: 424-354-3548

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

On Aug 28, 2012, at 10:42 AM, Tobias Horvath t...@tobyx.com wrote:

 On 28.08.2012, at 19:19, Steve Dennie steveden...@gmail.com wrote:
 
 I used Chrome and BBEdit all this morning. Then I upgraded to Mac OS 10.8.1, 
 and now neither of them will launch. Very frustrating. Fixed permissions, 
 but no luck. Yes, I'm running the latest BBEdit version.
 
 This problem seems to be related to your particular installation and not 
 BBEdit itself.
 Nevertheless, you'll get fast support by writing to supp...@barebones.com.
 
 T

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

2012-03-08 Thread Christian Boyce
I don't know how to do this with grep but I think I could do it in AppleScript. 
Would be a lot of looping but there is probably a way to make it more efficient 
as it works its way down the list.

c
On Mar 7, 2012, at 7:11 PM, Claude wrote:

 I need to remove multiple email addresses from a large list. Is there
 a way to compare two files and remove the addresses in one file from
 the other file?
 
 -- 
 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


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
New Main Phone Number: 424-354-3548

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Apple Event Predictions

-- 
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: Regex help - convert ALL CAPS to Caps if WORD is only WORD on line

2012-02-21 Thread Christian Boyce
I am sure that this is possible. 

I am also sure that there are a lot of people who can give you the magic 
formula, as easily as if you'd asked me for help spelling cat. However, if 
you don't get an answer from someone else, let me know. I speak a little GREP 
and think I could bang this out for you.

c
On Feb 21, 2012, at 11:11 AM, TJ Luoma wrote:

 
 Hi, my name is TJ and I'm terrible at regular expressions :-)
 
 Here's what I want to do:
 
 Match: Any line which is one word long (where 'word' is defined as
 ASCII letters, only) and that word is ALL CAPS
 
 Do:
 * Change word from UPPERCASE to Capitalized
 * Put a colon after WORD
 * Wrap that word (and colon) in ** **
 * Change EOL to a space.
 
 So, for example
 
 FOO
 bah ablah alasfas
 
 would become
 
 **Foo:** bah ablah alasfas
 
 Possible?
 
 -- 
 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


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
New Main Phone Number: 424-354-3548

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Built-in Siri Tip Sheet

-- 
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 Replace Help needed

2011-08-16 Thread Christian Boyce
Wow. Is that nice or what. Thank you Patrick!

On Aug 16, 2011, at 7:17 PM, Patrick James wrote:

 Handiest of all is that the ampersand reproduces the entire searched text. 
 This I use all the time. If you want to put p and /p around some para's 
 then it is:
 
 Find: .+
 
 Replace: p/p


--
Christian Boyce

-- 
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: First Line of Selection?

2011-06-22 Thread Christian Boyce
I think it is going to be easy.

tell application BBEdit
set the_text to the selection
set my_line to line 1 of the_text
end tell

Not paragraph 1. Line 1. Took a long time to trial-and-error that over here.

c
On Jun 22, 2011, at 8:52 AM, Warren Michelsen wrote:

 This ought to be very easy. I have html documents containing tables. No 
 colspan or rowspan properties are used so each table row has the same number 
 of columns.
 
 The documents are formatted such that each table row is one line in the 
 document; the line starts with tr and ends with /tr so that a complete 
 row can be selected by selecting a complete line.
 
 Now then, I seem to be having a problem using AS to select the first line of 
 a document's selection.  I've tried all kinds of things up to:
 
   set my_line to paragraph 1 of the selection of text document 1 of text 
 window 1
 
 I keep getting the error: An attempt was made to resolve an Apple Event 
 reference to a non-existent object.
 
 How does one set a variable to the first line of the selected text of the 
 front-most BBEdit document window?
 
 All I want to do is get the characters of that first line and count the 
 instances of td to determine how many columns the selected table has.
 
 I thought this was going to be easy... 
 
 -- 
 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


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
310-452-3720

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Search Google Images by COLOR

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