Re: typing surround delimiters... Is single quote supposed to work too?

2019-04-26 Thread Christopher Stone
On 04/26/2019, at 13:32, Rails Smith mailto:rails.sm...@mediaweb.com>> wrote:
> It need not be the default configuration. 
> It could help maintain a larger paying customer base. 


Hey Rails,

Keep in mind that with AppleScript you can radically customize what BBEdit does 
under a variety of circumstances.

--
Best Regards,
Chris


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


Relative Alias Creator AppleScript ⇢ was ⇢ Any way to DESELECT/UNSELECT selected text?

2019-04-26 Thread Christopher Stone
So when I want to use a $HOME-based path in a publicly posted script I usually use the Tilde-format (~/your_path).Hey Alfredo,I forgot to mention that I have a script to create relative-aliases for me.Years ago I got tired of making them manually.--Take Care,Chris



-- 
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: 
--- 
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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Sam Hathaway

On 26 Apr 2019, at 16:38, Patrick Woolsey wrote:

sometimes it can still be helpful to start with a simple solution and 
work out from there.


Agreed!
-sam

--
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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Patrick Woolsey
That is true and my apologies for not including a suitable 
caveat in my prior post, though sometimes it can still be 
helpful to start with a simple solution and work out from there. :-)


Regards,

  -- Patrick


On 4/26/19 at 4:21 PM, list.bbe...@munkynet.org (Sam Hathaway) wrote:


I’m not sure this can be made to be reliable. Regular expressions can’t balance 
tags, so:

```html

Leave me out!

Include me!
And me!
And also me!

But not me.

```

Will result in:

```html

Include me!
And me!
```

If you make the pattern greedy, you’ll get:

```html

Include me!
And me!
And also me!

But not me.

```

Just fine if you don’t have any DIVs inside your main-content DIV, but how 
likely is that?

Better off using a tool that’s designed to manipulate HTML. 
Some options [here](https://superuser.com/questions/528709/command-line-css-selector-tool/528728).


It’d be lovely if BBEdit could allow find/replace based on 
CSS selectors or XPath expressions in addition to text and 
regexps. But presumably that would be a large undertaking.


Just my 2¢.
-sam

On 26 Apr 2019, at 16:11, Patrick Woolsey wrote:


On 4/26/19 at 3:07 PM, focusedcreat...@gmail.com (Phil Emery) wrote:

Ideally it would be great to delete all other content from 
each existing file.


OK, thanks and in that case, you should be able to obtain the 
desired outcome by performing a multi-file search & replace 
with "Grep" enabled and patterns like these:


Find:  \A(?s).+?((?s).+?)(?s).+

Replace:   \1

and in short, here's how the patterns work:

The Find pattern begins by matching at the start of the 
document \A and then _non-greedily_ matches ? one or more 
instances of any character .+ _including_ line breaks 
(achieved by pre-pending (?s) to the .) and followed by a 
single _sub-pattern_, whose contents are enclosed in 
parentheses ( ) and consist of the opening div followed by one 
or more characters in another non-greedy match across lines 
and then a closing div, and finally matching any characters 
remaining in the document, including line breaks (?s).+


[NB: You'll need to adjust the exact form of the desired  
to suit
your content, i.e. depending whether these sections are 
identified by

'class', 'name', or 'id'.]

The Replace pattern then reinserts only the contents of the 
matched subpattern (consisting of the desired div, its 
contents, and the closing div), thus effectively deleting 
everything else.


As always, I recommend you try this procedure out on a few 
sample files or a cloned copy before applying it to your 
actual data, just to make sure it's doing what you 
expect/want. :-)



Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Sam Hathaway
I’m not sure this can be made to be reliable. Regular expressions 
can’t balance tags, so:


```html

 Leave me out!
 
  Include me!
   And me!
  And also me!
 
 But not me.

```

Will result in:

```html

  Include me!
   And me!
```

If you make the pattern greedy, you’ll get:

```html

  Include me!
   And me!
  And also me!
 
 But not me.

```

Just fine if you don’t have any DIVs inside your main-content DIV, but 
how likely is that?


Better off using a tool that’s designed to manipulate HTML. Some 
options 
[here](https://superuser.com/questions/528709/command-line-css-selector-tool/528728).


It’d be lovely if BBEdit could allow find/replace based on CSS 
selectors or XPath expressions in addition to text and regexps. But 
presumably that would be a large undertaking.


Just my 2¢.
-sam

On 26 Apr 2019, at 16:11, Patrick Woolsey wrote:


On 4/26/19 at 3:07 PM, focusedcreat...@gmail.com (Phil Emery) wrote:

Ideally it would be great to delete all other content from each 
existing file.


OK, thanks and in that case, you should be able to obtain the desired 
outcome by performing a multi-file search & replace with "Grep" 
enabled and patterns like these:


Find:  \A(?s).+?((?s).+?)(?s).+

Replace:   \1

and in short, here's how the patterns work:

The Find pattern begins by matching at the start of the document \A 
and then _non-greedily_ matches ? one or more instances of any 
character .+ _including_ line breaks (achieved by pre-pending (?s) to 
the .) and followed by a single _sub-pattern_, whose contents are 
enclosed in parentheses ( ) and consist of the opening div followed by 
one or more characters in another non-greedy match across lines and 
then a closing div, and finally matching any characters remaining in 
the document, including line breaks (?s).+


   [NB: You'll need to adjust the exact form of the desired  to 
suit
your content, i.e. depending whether these sections are identified 
by

'class', 'name', or 'id'.]

The Replace pattern then reinserts only the contents of the matched 
subpattern (consisting of the desired div, its contents, and the 
closing div), thus effectively deleting everything else.


As always, I recommend you try this procedure out on a few sample 
files or a cloned copy before applying it to your actual data, just to 
make sure it's doing what you expect/want. :-)



Regards,

  Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Patrick Woolsey

On 4/26/19 at 3:07 PM, focusedcreat...@gmail.com (Phil Emery) wrote:

Ideally it would be great to delete all other content from each 
existing file.


OK, thanks and in that case, you should be able to obtain the 
desired outcome by performing a multi-file search & replace with 
"Grep" enabled and patterns like these:


Find:  \A(?s).+?((?s).+?)(?s).+

Replace:   \1

and in short, here's how the patterns work:

The Find pattern begins by matching at the start of the document 
\A and then _non-greedily_ matches ? one or more instances of 
any character .+ _including_ line breaks (achieved by 
pre-pending (?s) to the .) and followed by a single 
_sub-pattern_, whose contents are enclosed in parentheses ( ) 
and consist of the opening div followed by one or more 
characters in another non-greedy match across lines and then a 
closing div, and finally matching any characters remaining in 
the document, including line breaks (?s).+


   [NB: You'll need to adjust the exact form of the desired 
 to suit
your content, i.e. depending whether these sections are 
identified by

'class', 'name', or 'id'.]

The Replace pattern then reinserts only the contents of the 
matched subpattern (consisting of the desired div, its contents, 
and the closing div), thus effectively deleting everything else.


As always, I recommend you try this procedure out on a few 
sample files or a cloned copy before applying it to your actual 
data, just to make sure it's doing what you expect/want. :-)



Regards,

  Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 
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: typing surround delimiters... Is single quote supposed to work too?

2019-04-26 Thread Patrick Woolsey

On 4/26/19 at 2:32 PM, rails.sm...@mediaweb.com (Rails Smith) wrote:


I'm about to report a separate bug that makes me wonder how long I will
keep paying for BBedit.



If you've got an issue to report, by all means please do -- 
"Operators are standing by." :-)



Regards,

  Patrick Woolsey
==
Bare Bones Software, Inc. 


--
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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Phil Emery
Ideally it would be great to delete all other content from each existing 
file.



On Friday, 26 April 2019 14:59:34 UTC-4, Patrick Woolsey wrote:
>
> On 4/26/19 at 2:40 PM, focused...@gmail.com  (Phil Emery) 
> wrote: 
>
> >I have a folder full of html pages (.html). Each file has a lot 
> >of stuff we don't need. Every page has content within a div 
> >called "main-content". The only stuff we need is within that div. 
> > 
> >I'm pretty sure that via some fancy Grep-ing it could delete 
> >everything out of those files EXCEPT what's contained within 
> >the "main-content" div. But I can't figure it out. 
>
>
> To help define the scope of the task: 
>
> Do you need to delete all the other content from each existing 
> file, or would you instead be satisfied to extract the contents 
> of every such div for use elsewhere? 
>
>
> Regards, 
>
>Patrick Woolsey 
> == 
> Bare Bones Software, Inc.  
>
>

-- 
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: 
--- 
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: Advanced Grep querys

2019-04-26 Thread Patrick Woolsey

On 4/26/19 at 2:40 PM, focusedcreat...@gmail.com (Phil Emery) wrote:

I have a folder full of html pages (.html). Each file has a lot 
of stuff we don't need. Every page has content within a div 
called "main-content". The only stuff we need is within that div.


I'm pretty sure that via some fancy Grep-ing it could delete 
everything out of those files EXCEPT what's contained within 
the "main-content" div. But I can't figure it out.



To help define the scope of the task:

Do you need to delete all the other content from each existing 
file, or would you instead be satisfied to extract the contents 
of every such div for use elsewhere?



Regards,

  Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 
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: typing surround delimiters... Is single quote supposed to work too?

2019-04-26 Thread Sam Hathaway

Yikes!

On 26 Apr 2019, at 14:32, Rails Smith wrote:


It need not be the default configuration.
It could help maintain a larger paying customer base.
I'm about to report a separate bug that makes me wonder how long I 
will

keep paying for BBedit.
We have fight club rules here when it comes to defects.
Or, on second thought... we could have mutually exclusive selector for 
two

modes in the same binary:
   o Senior mode
   o Millennial mode

  :-)


On Thu, Apr 25, 2019 at 5:08 PM @lbutlr  wrote:

On 24 Apr 2019, at 21:23, Rails Smith  
wrote:

Double quote, square brackets, curly brackets works for me.
Will angle brackets and forward-slash be added?


Oh no, please no.


--
Living is easy with eyes closed, misunderstanding all you see


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


Advanced Grep querys

2019-04-26 Thread Phil Emery
Hi

Long time BBEditer (v3) here.

In the past I've eventually gotten Grep to do some pretty cool things, but 
this is a bit out of my expertise -- not being a programmer.

I have a folder full of html pages (.html). Each file has a lot of stuff we 
don't need. Every page has content within a div called "main-content". The 
only stuff we need is within that div.

I'm pretty sure that via some fancy Grep-ing it could delete everything out 
of those files EXCEPT what's contained within the "main-content" div. But I 
can't figure it out.

I was hoping there was a "Grep builder" on the web somewhere but there 
doesn't seem to be one that I can find.

Any help would be greatly appreciated.

-- 
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: 
--- 
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: typing surround delimiters... Is single quote supposed to work too?

2019-04-26 Thread Rails Smith
It need not be the default configuration.
It could help maintain a larger paying customer base.
I'm about to report a separate bug that makes me wonder how long I will
keep paying for BBedit.
We have fight club rules here when it comes to defects.
Or, on second thought... we could have mutually exclusive selector for two
modes in the same binary:
   o Senior mode
   o Millennial mode

  :-)


On Thu, Apr 25, 2019 at 5:08 PM @lbutlr  wrote:

> On 24 Apr 2019, at 21:23, Rails Smith  wrote:
> > Double quote, square brackets, curly brackets works for me.
> > Will angle brackets and forward-slash be added?
>
> Oh no, please no.
>
>
> --
> Living is easy with eyes closed, misunderstanding all you see
>
>
> --
> 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: 
> ---
> 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: 
--- 
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: Any way to DESELECT/UNSELECT selected text ?

2019-04-26 Thread F. Alfredo Rego
Hey Chris,

Very nice description of your system.

Thanks to Rich’s example, I don’t even consider dealing with selection at all 
(for this particular project). So, I’m in good shape regarding the “de-need” 
(“un-need”?) for “virtual selection of nothing”. It’s good to know your 
technique (select insertion point before its text), so I appreciate learning 
about it.

With gratitude,

Alfredo

> On Apr 26, 2019, at 2:19 AM, Christopher Stone  
> wrote:
> 
> On 04/21/2019, at 10:11, F. Alfredo Rego  > wrote:
>> I’m using AppleScript + BBEdit to “refresh” all the files in the “Release” 
>> directory with the contents of all the files in the “Prototype” directory. I 
>> do this “transfer of the file contents” (instead of simply copying and 
>> over-writing the files), to preserve the entire git history of each 
>> “Release” file.
>> 
>> I have explored everywhere I can, but I can’t find any way to 
>> DESELECT/UNSELECT selected text.
> 
> 
> Hey Alfredo,
> 
> This is not at all intuitive.  You can't de-select text directly, but you can 
> set the selection to nothing like so.
> 
> 
> tell application "BBEdit"
> tell front text window
> select insertion point before its text
> end tell
> end tell
> 
> 
> As Rich observed – you don't need to select the text to meet your objective.
> 
> I would write your script similarly to this:
> 
> 
> set filePath to "~/test_directory/BBEdit_Test_Dir_Level_01/textFile.txt"
> 
> tell application "System Events"
> set filePath to POSIX path of disk item filePath
> end tell
> 
> tell application "BBEdit"
> # activate -- No need IF BBEdit is already frontmost.
> set myDoc to open filePath with LF translation
> set dataStr to text of myDoc
> end tell
> 
> 
> Although I generally use what I call Relative-Aliases to reference files in 
> my $HOME directory:
> 
> set fileAlias to alias ((path to home folder as text) & 
> "test_directory:BBEdit_Test_Dir_Level_01:textFile.txt")
> 
> I don't often publish scripts publicly this way anymore, because most people 
> don't understand what a relative-alias is.
> 
> So when I want to use a $HOME-based path in a publicly posted script I 
> usually use the Tilde-format (~/your_path).
> 
> I have a handler for converting them to a full POSIX Path that's way faster 
> than System Events, but using SE is easy and ~ 0.02 seconds is fast enough 
> for most folks.
> 
> Relative paths (of either kind) are portable through changes in hard drive 
> names and user-folder names, whereas hard-coded paths are often broken by 
> those changes.
> 
> I learned this lesson long ago after buying a new Mac and changing my HD name 
> and having to edit hundreds of scripts to get them working again...
> 
> I don't generally like to place paths within application-tell blocks for too 
> many reasons to get in to here.
> 
> --
> Take Care,
> Chris
> 
> 
> -- 
> 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:  >
> --- 
> 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: 
--- 
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: Any way to DESELECT/UNSELECT selected text ?

2019-04-26 Thread Christopher Stone
On 04/21/2019, at 10:11, F. Alfredo Rego mailto:f.alfredor...@gmail.com>> wrote:
> I’m using AppleScript + BBEdit to “refresh” all the files in the “Release” 
> directory with the contents of all the files in the “Prototype” directory. I 
> do this “transfer of the file contents” (instead of simply copying and 
> over-writing the files), to preserve the entire git history of each “Release” 
> file.
> 
> I have explored everywhere I can, but I can’t find any way to 
> DESELECT/UNSELECT selected text.


Hey Alfredo,

This is not at all intuitive.  You can't de-select text directly, but you can 
set the selection to nothing like so.


tell application "BBEdit"
tell front text window
select insertion point before its text
end tell
end tell


As Rich observed – you don't need to select the text to meet your objective.

I would write your script similarly to this:


set filePath to "~/test_directory/BBEdit_Test_Dir_Level_01/textFile.txt"

tell application "System Events"
set filePath to POSIX path of disk item filePath
end tell

tell application "BBEdit"
# activate -- No need IF BBEdit is already frontmost.
set myDoc to open filePath with LF translation
set dataStr to text of myDoc
end tell


Although I generally use what I call Relative-Aliases to reference files in my 
$HOME directory:

set fileAlias to alias ((path to home folder as text) & 
"test_directory:BBEdit_Test_Dir_Level_01:textFile.txt")

I don't often publish scripts publicly this way anymore, because most people 
don't understand what a relative-alias is.

So when I want to use a $HOME-based path in a publicly posted script I usually 
use the Tilde-format (~/your_path).

I have a handler for converting them to a full POSIX Path that's way faster 
than System Events, but using SE is easy and ~ 0.02 seconds is fast enough for 
most folks.

Relative paths (of either kind) are portable through changes in hard drive 
names and user-folder names, whereas hard-coded paths are often broken by those 
changes.

I learned this lesson long ago after buying a new Mac and changing my HD name 
and having to edit hundreds of scripts to get them working again...

I don't generally like to place paths within application-tell blocks for too 
many reasons to get in to here.

--
Take Care,
Chris

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