Re: Need some help with multiple search-replace Apple script

2020-12-16 Thread Christopher Stone
On 12/15/2020, at 00:42, Mathias mailto:math...@lightlabs.se>> wrote:
> Below are three example rows the way they work on Android, followed by their 
> equivalent IOS counterparts.
> 
> Switch account
> Automatic check-in to %1$s
> Choose location
> 
> 
> "switch_header" = "Switch account";
> "automaticCheckinTo" = "Automatic check-in to %@";
> "shortcut_subtitle_checkin" = "Choose location";


Hey Mathias,

Okay, that helps.

Let's start with AppleScript, since that's the way you began yourself.


# Auth: Christopher Stone
# dCre: 2020/12/17 00:01
# dMod: 2020/12/17 00:01 
# Appl: BBEdit
# Task: Android Strings to Equivalent iOS Strings.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Android, @IOS, @RegEx


tell application "BBEdit"
tell front text window

replace "([^<]+?)" using "\\1 = 
\"\\2\";" options ¬
{search mode:grep, case sensitive:false, starting at top:true}
replace "%1$s" using "%@" options {case sensitive:false, starting at 
top:true}

end tell
end tell





# Auth: Christopher Stone
# dCre: 2020/12/17 00:01
# dMod: 2020/12/17 00:03
# Appl: BBEdit
# Task: iOS Strings to Equivalent Android Strings.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Android, @IOS, @RegEx


tell application "BBEdit"
tell front text window

replace "(\"[^\"]+?\") = \"([^\"]+?)\";" using "\\2" options ¬
{search mode:grep, case sensitive:false, starting at top:true} -- 
RegEx replacement.
replace "%@" using "%1$s" options {case sensitive:false, starting at 
top:true} -- Literal replacement.

end tell
end tell




Now let's attempt some Perl:


#!/usr/bin/env perl -0777 -nw
# 
# Auth: Christopher Stone
# dCre: 2020/12/17 00:20
# dMod: 2020/12/17 00:21
# Task: Android Strings to Equivalent iOS Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @Perl
# 

s!([^<]+?)!$1 = "$2";!ig;
s!%1\$s!%@!ig;

print;

# 


#!/usr/bin/env perl -0777 -nw
# 
# Auth: Christopher Stone
# dCre: 2020/12/17 00:20
# dMod: 2020/12/17 00:28
# Task: iOS Strings to Equivalent Android Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @Perl
# 

s!("[^"]+?") = "([^"]+?)";!$2!ig;
s!%@!%1\$s!ig;

print;

# 

In this case I'm scarfing up the whole file before doing the search/replace.  
If the file was really big I'd iterate through the lines in a while loop.

Now for giggles let's trot out sed:

#!/usr/bin/env bash
# 
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2020/12/17 01:05
# Task: Android Strings to Equivalent iOS Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @sed
# 

sed -En '

   s!([^<]+)!\1 = "\2";!
   s!%1\$s!%@!
   p
   
'

# 


#!/usr/bin/env bash
# 
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2020/12/17 00:53 
# Task: iOS Strings to Equivalent Android Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @sed
# 

sed -En '

   s!("[^"]+") = "([^"]+)";!\2!
   s!%@!%1$s!
   p
   
'

# 


Let me know if you have any problems.

--
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 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/DDF7E0ED-9E58-443D-9059-D0F9892A03D4%40gmail.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Pixel Clef
I've tried [The "Sidebar" preferences].

[Currently Open Documents] keeps coming back.

It's possible I'm just being a curmudgeon and recalling the old days where 
TextWrangler had a "Hit It With a Hammer" setting that would forever rid me 
of this dubious Shiny New Feature. But I've now changed:
Preferences > Sidebar > Automatically show sidebar to √ Never
Preferences > Sidebar > Reshape window when showing or hiding sidebar to _ 
Unchecked
Preferences > Sidebar > Add documents to sidebar in alphabetical order to _ 
Unchecked
Preferences > Sidebar > Show icons in sidebar lists to _ Unchecked

And am confused when Ye Olde Currently Open Documents reappears.

If I could identify what sequence of events predicates this, I could 
possibly be on to something.

Thanks for the suggestions!

On Wednesday, December 16, 2020 at 9:54:35 AM UTC-6 sie...@barebones.com 
wrote:

> On 16 Dec 2020, at 10:51, Pixel Clef wrote:
>
> > I've tried that.
> >
> > It keeps coming back.
>
> Too many pronouns, use fewer. :-)
>
> Seriously, though, if something's not working the way you think it 
> should, email to  is probably your best bet.
>
> R.
>
> -- 
> Rich Siegel Bare Bones Software, Inc.
>  
>
> Someday I'll look back on all this and laugh... until they sedate me.
>

-- 
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/472b94b6-950c-49d5-abf2-86fc65d6a2d6n%40googlegroups.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Rich Siegel

On 16 Dec 2020, at 10:51, Pixel Clef wrote:


I've tried that.

It keeps coming back.


Too many pronouns, use fewer. :-)

Seriously, though, if something's not working the way you think it 
should, email to  is probably your best bet.


R.

--
Rich Siegel Bare Bones Software, Inc.
  

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

--
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/B2B00890-4422-4C31-B04A-A5026EA025E1%40barebones.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Pixel Clef
I've tried that.

It keeps coming back.

On Wednesday, December 16, 2020 at 9:51:04 AM UTC-6 sie...@barebones.com 
wrote:

> On 16 Dec 2020, at 10:49, Pixel Clef wrote:
>
> > Never show the Currently Open Documents.
> >
> > The document drop down menu is enough for me. I'm fine with all the
> > documents being in one window. Required, in fact.
> > I just don't want to ever see that Currently Open Documents
> > sidebar/panel/drawer/whateveritscalledthisyear :-D
>
> The "Sidebar" preferences will probably do what you need.
>
> Enjoy,
>
> R.
>
> -- 
> Rich Siegel Bare Bones Software, Inc.
>  
>
> Someday I'll look back on all this and laugh... until they sedate me.
>

-- 
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/f4eb1013-b63d-482b-93ad-f53ec857f11an%40googlegroups.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Rich Siegel
On 16 Dec 2020, at 10:49, Pixel Clef wrote:

> Never show the Currently Open Documents.
>
> The document drop down menu is enough for me. I'm fine with all the
> documents being in one window. Required, in fact.
> I just don't want to ever see that Currently Open Documents
> sidebar/panel/drawer/whateveritscalledthisyear :-D

The "Sidebar" preferences will probably do what you need.

Enjoy,

R.

-- 
Rich Siegel Bare Bones Software, Inc.
  

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

-- 
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/2F2A2027-402E-4480-82FE-15A284D39EC5%40barebones.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Pixel Clef
Never show the Currently Open Documents.

The document drop down menu is enough for me. I'm fine with all the 
documents being in one window. Required, in fact.
I just don't want to ever see that Currently Open Documents 
sidebar/panel/drawer/whateveritscalledthisyear :-D

On Wednesday, December 16, 2020 at 9:47:44 AM UTC-6 sie...@barebones.com 
wrote:

> On 16 Dec 2020, at 10:43, Pixel Clef wrote:
>
> > Many years ago, there was an Expert Preference to disable the Currently
> > Open Documents sidebar. Not temporarily hide it or close it, but stop
> > showing it forever.
> >
> > I've had to reload everything, and now can't locate this setting.
>
> Do you want to open each document into a separate window?
>
> Or do you simply want the sidebar hidden at all times?
>
> R.
>
> -- 
> Rich Siegel Bare Bones Software, Inc.
>  
>
> Someday I'll look back on all this and laugh... until they sedate me.
>

-- 
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/a070c33e-5ad3-4537-9ddc-0e30daf6de25n%40googlegroups.com.


Re: Disable Currently Open Documents

2020-12-16 Thread Rich Siegel
On 16 Dec 2020, at 10:43, Pixel Clef wrote:

> Many years ago, there was an Expert Preference to disable the Currently
> Open Documents sidebar. Not temporarily hide it or close it, but stop
> showing it forever.
>
> I've had to reload everything, and now can't locate this setting.

Do you want to open each document into a separate window?

Or do you simply want the sidebar hidden at all times?

R.

-- 
Rich Siegel Bare Bones Software, Inc.
  

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

-- 
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/00BBB242-71EB-4859-9435-0A59E3228783%40barebones.com.


Disable Currently Open Documents

2020-12-16 Thread Pixel Clef
Many years ago, there was an Expert Preference to disable the Currently 
Open Documents sidebar. Not temporarily hide it or close it, but stop 
showing it forever.

I've had to reload everything, and now can't locate this setting.

-- 
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/1cc40095-8e9e-4e04-a498-20ec9a258855n%40googlegroups.com.