Re: Deleting a file via AppleScript

2021-03-22 Thread F. Alfredo Rego
I’m impressed by all the different approaches and perspectives.

I hope other people have experienced a similar widening and deepening of 
knowledge regarding the nuances of this topic.

Thanks to everyone!

Alfredo

-- 
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/35841C91-8770-4146-A160-2C8265CACB01%40gmail.com.


Re: Deleting a file via AppleScript

2021-03-22 Thread Peace Keeper
Before I would use rsync from the terminal, you might try out Unison 
(https://www.cis.upenn.edu/~bcpierce/unison/ ) or RsyncOSX 
(https://github.com/rsyncOSX/RsyncOSX) which have GUI's to handle bigger 
directories. - just a thought

Harvey Pikelberger schrieb am Montag, 22. März 2021 um 17:11:38 UTC+1:

> Great.  Glad that worked out.
>
> On Mar 22, 2021, at 8:15 AM, F. Alfredo Rego  wrote:
>
> Hi “MediaMouth” (sorry about my not knowing your name),
>
> This is perfect.
>
> This makes my Rube-Goldberg approach immediately obsolete.
>
> Your approach cuts away all the unnecessary fat and produces a lean 
> structure.
>
> I’m quickly learning that there’s a command-line app for “that” (whatever 
> “that” may be). The trick (at least for me) is finding out which one 
> applies to what.
>
> Thank you so much for the excellent description.
>
> Alfredo
>
>
>

-- 
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/025f00c8-fe1c-4921-b123-1339b19e03d9n%40googlegroups.com.


Re: Deleting a file via AppleScript

2021-03-22 Thread MediaMouth
Great.  Glad that worked out.

> On Mar 22, 2021, at 8:15 AM, F. Alfredo Rego  wrote:
> 
> Hi “MediaMouth” (sorry about my not knowing your name),
> 
> This is perfect.
> 
> This makes my Rube-Goldberg approach immediately obsolete.
> 
> Your approach cuts away all the unnecessary fat and produces a lean structure.
> 
> I’m quickly learning that there’s a command-line app for “that” (whatever 
> “that” may be). The trick (at least for me) is finding out which one applies 
> to what.
> 
> Thank you so much for the excellent description.
> 
> Alfredo

-- 
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/60A2FC9B-1A57-4642-95D5-7DF1B317300C%40gmail.com.


Re: Deleting a file via AppleScript

2021-03-22 Thread F. Alfredo Rego
Hi “MediaMouth” (sorry about my not knowing your name),

This is perfect.

This makes my Rube-Goldberg approach immediately obsolete.

Your approach cuts away all the unnecessary fat and produces a lean structure.

I’m quickly learning that there’s a command-line app for “that” (whatever 
“that” may be). The trick (at least for me) is finding out which one applies to 
what.

Thank you so much for the excellent description.

Alfredo

> On Mar 21, 2021, at 1:33 AM, MediaMouth  wrote:
> 
> Hi Alfredo,
> 
> I wonder if a solution here is rsync.
> This is a command line app that can easily be run from AppleScript.  It 
> 'syncs' two directories, a source to a dest (in your case alpha 
> (pre-production) to beta (production))
> 
> rsync -avu '/path/to/alpha/directory' '/path/to/beta/directory'
> 
> This will update all modified files and add new files from  from alpha to 
> beta.  It will not delete items from beta when items are deleted from alpha.  
> To achieve that...
> 
> rsync -avu --delete '/path/to/alpha/directory' '/path/to/beta/directory'
> 
> The added --delete option only affects beta, not alpha
> 
> Explainer for -avu options
> a: 'archive mode' makes sure things like creation date and mod dates are 
> passed from alpha to beta
> v: 'verbose' show a lot of feedback
> u: skip files in beta that are newer than those in alpha. (ie saves time)
> 
> Ordinarily you do all that in Terminal, which you can call from BBedit.
> But you can also run it from AppleScript:
> 
> do shell script "rsync -avu '/path/to/alpha/directory' 
> '/path/to/beta/directory'"
> 
> Your workflow may have other nuances not captured above, but based on your 
> notes, you might be able to replace an elaborate sequence of Automator and 
> AppleScript with a single line of code easily run from within 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 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/67D08C02-D20D-45F8-90DC-2E4A3B617D69%40gmail.com.


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

2021-03-22 Thread Kaveh Bazargan
Try removing the ^ at the start of search. This is because once you have
placed the bullet, the next char is no longer at the start of line. now you
will just be searching from the bullet forwards. So search is now:

([^\t]+)\t([^\t]+\r)(?=\1)

I also put the last \r inside the second bracketed text. Works here.

On Mon, 22 Mar 2021 at 12:50, Tim A  wrote:

> Neat.
> Any way to single step thru Find/Replace to watch the the grep pattern
> progress instead of doing a Replace All?
> If I do a Next and Replace it doesn't work properly.
>
> Thanks
>
> On Sunday, March 21, 2021 at 5:42:16 AM UTC-7 Kaveh wrote:
>
>> Here is a two stage regex solution. Assuming no bullets (•) in your file,
>>
>> Search: ^([^\t]+)\t([^\t]+)\r(?=\1)
>> replace: \1\t\2\r•
>>
>> Search: •[^\t]+
>> Replace with empty
>>
>> On Sun, 21 Mar 2021 at 08:47, Christopher Stone 
>> wrote:
>>
>>> On 03/20/2021, at 15:48, John Delacour  wrote:
>>>
>>> That makes no sense to me.  If the current col1 is identical to col1 of
>>> the previous line, then the value will not be printed; that is the clear
>>> logic of the routine.  I cannot reproduce your error.
>>>
>>> --
>>>
>>> Hey Folks,
>>>
>>> I'm with JD on this one.  I ran his script on a sample file, and it
>>> performed as expected.
>>>
>>> Samar – I'd want a zipped copy of your test file that's failing to
>>> test.  Also - you said you're working with a *large* file.  How large?
>>> It makes a difference in how one approaches the problem.
>>>
>>> I like JD's Perl solution for this.  It's neat, clean, fast, and will
>>> handle big files with ease.
>>>
>>> If I *was* to use AppleScript I'd go this route:
>>>
>>> ---
>>> # Auth: Christopher Stone 
>>> # dCre: 2021/03/21 02:56
>>> # dMod: 2021/03/21 02:56
>>> # Appl: BBEdit
>>> # Task: Massage Text of Columns A and B of a Table.
>>> # Libs: None
>>> # Osax: None
>>> # Tags: @Applescript, @Script, @BBEdit
>>> ---
>>>
>>> *set* colAStr *to* *missing value*
>>> *set* {oldTIDS, AppleScript's text item delimiters} *to* {AppleScript's text
>>> item delimiters, tab}
>>>
>>> *tell* *application* "BBEdit" *to* ¬
>>> *set* paragraphList *to* contents *of* *lines* *of* *front*
>>> *document* *where* *its* contents *is* *not* ""
>>>
>>> *repeat* *with* i *in* paragraphList
>>> *if* colAStr = *text item* 1 *of* i *then*
>>> *set* contents *of* i *to* tab & *text item* 2 *of* i
>>> *else*
>>> *set* colAStr *to* *text item* 1 *of* i
>>> *end* *if*
>>> *end* *repeat*
>>>
>>> *set* AppleScript's text item delimiters *to* linefeed
>>> *set* paragraphList *to* paragraphList *as* *text*
>>> *set* AppleScript's text item delimiters *to* oldTIDS
>>>
>>> *tell* *application* "BBEdit" *to* ¬
>>> *set* *text* *of* *front* *document* *to* paragraphList
>>>
>>> ---
>>>
>>> Although it could bog down with very big files.
>>>
>>>
>>> --
>>> Best Regards,
>>> Chris
>>>
>>> --
>>> This is the BBEdit Talk public discussion group. If you have a feature
>>> request or need technical support, please email "sup...@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+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/bbedit/B75B0684-484C-4034-AF69-D0731A9FE590%40gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Kaveh Bazargan PhD
>> Director
>> River Valley Technologies  ● Twitter
>>  ● LinkedIn
>>  ● ORCID
>> 
>> *Accelerating the Communication of Research*
>>
> --
> 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/1aaf8e41-f479-431e-a290-777609746a27n%40googlegroups.com
> 
> .
>


-- 
Kaveh Bazargan PhD
Director
River Valley Technologies 

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

2021-03-22 Thread Tim A
Neat. 
Any way to single step thru Find/Replace to watch the the grep pattern 
progress instead of doing a Replace All? 
If I do a Next and Replace it doesn't work properly.

Thanks

On Sunday, March 21, 2021 at 5:42:16 AM UTC-7 Kaveh wrote:

> Here is a two stage regex solution. Assuming no bullets (•) in your file, 
>
> Search: ^([^\t]+)\t([^\t]+)\r(?=\1)
> replace: \1\t\2\r•
>
> Search: •[^\t]+
> Replace with empty
>
> On Sun, 21 Mar 2021 at 08:47, Christopher Stone  
> wrote:
>
>> On 03/20/2021, at 15:48, John Delacour  wrote:
>>
>> That makes no sense to me.  If the current col1 is identical to col1 of 
>> the previous line, then the value will not be printed; that is the clear 
>> logic of the routine.  I cannot reproduce your error.
>>
>> --
>>
>> Hey Folks,
>>
>> I'm with JD on this one.  I ran his script on a sample file, and it 
>> performed as expected.
>>
>> Samar – I'd want a zipped copy of your test file that's failing to test.  
>> Also - you said you're working with a *large* file.  How large?  It 
>> makes a difference in how one approaches the problem.
>>
>> I like JD's Perl solution for this.  It's neat, clean, fast, and will 
>> handle big files with ease.
>>
>> If I *was* to use AppleScript I'd go this route:
>>
>> ---
>> # Auth: Christopher Stone 
>> # dCre: 2021/03/21 02:56
>> # dMod: 2021/03/21 02:56 
>> # Appl: BBEdit
>> # Task: Massage Text of Columns A and B of a Table.
>> # Libs: None
>> # Osax: None
>> # Tags: @Applescript, @Script, @BBEdit
>> ---
>>
>> *set* colAStr *to* *missing value*
>> *set* {oldTIDS, AppleScript's text item delimiters} *to* {AppleScript's text 
>> item delimiters, tab}
>>
>> *tell* *application* "BBEdit" *to* ¬
>> *set* paragraphList *to* contents *of* *lines* *of* *front* 
>> *document* *where* *its* contents *is* *not* ""
>>
>> *repeat* *with* i *in* paragraphList
>> *if* colAStr = *text item* 1 *of* i *then*
>> *set* contents *of* i *to* tab & *text item* 2 *of* i
>> *else*
>> *set* colAStr *to* *text item* 1 *of* i
>> *end* *if*
>> *end* *repeat*
>>
>> *set* AppleScript's text item delimiters *to* linefeed
>> *set* paragraphList *to* paragraphList *as* *text*
>> *set* AppleScript's text item delimiters *to* oldTIDS
>>
>> *tell* *application* "BBEdit" *to* ¬
>> *set* *text* *of* *front* *document* *to* paragraphList
>>
>> ---
>>
>> Although it could bog down with very big files.
>>
>>
>> --
>> Best Regards,
>> Chris
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/B75B0684-484C-4034-AF69-D0731A9FE590%40gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies  ● Twitter 
>  ● LinkedIn 
>  ● ORCID 
> 
> *Accelerating the Communication of Research*
>

-- 
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/1aaf8e41-f479-431e-a290-777609746a27n%40googlegroups.com.


Re: Deleting emoji characters

2021-03-22 Thread @lbutlr
On 24 Oct 2020, at 18:02, Tim A  wrote:
> Thanks all for the quick and informative responses . The "Text -> Zap 
> Gremlin" of Rod did the trick!

Be careful, when you are dealing with a UTF-8 document, this may zap more tan 
you want.

Forexample, I often use ¹ and ² in documents and simply removing them will 
cause the footnotes in the text to lose their context.

There are, of course, many other UTF-8 characters that may be zapped, including 
ñ and √ and ç that may cause problems if removed.

If you change 2√x to 2/x by zapping, that could be very bad.

-- 
Stupid men are often capable of things the clever would not dare to
contemplate... --Feet of Clay

-- 
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/544AA664-2AC6-469C-93F0-F3F6CAB22F30%40kreme.com.


Re: Find/Replace with Regex expression

2021-03-22 Thread @lbutlr
On 21 Mar 2021, at 16:27, 'Ken Brown' via BBEdit Talk  
wrote:
> I had not used grep Find/Replace regex for awhile, let me take this time to 
> thank the developers of BBEdit for the great help in the Find/Replace dialog 
> ? Button, and the way that the 'show matches' checkbox causes highlights for 
> the operation of the potential find! 

Even as someone who uses regex all the time (not well, mind you, but I blunder 
through) this feature is really great and I love showing it and "Pattern 
Playground" off to people.


-- 
Rule #5: Get Kirsten Dunst Wet

-- 
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/E28F80AF-58E3-41A5-AF9F-783151170BF8%40kreme.com.