[Clip] Re: Adding a second when there's a tenth or more

Expand Messages
• ... Thanks for that hint, Axel. I had prepared the following reply before I could study your next post. So before getting to this let me post my first reply in
Message 1 of 14 , May 24, 2013
• 0 Attachment
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> "flo.gehrke" wrote:
> > ^!Find "([0][1-9]):60\$" RS
> > ^!Find "(\d\d):60\$" RS
>
> It took me some time to understand why you treat those two cases
> differently. It seems to me that for 09:60 your soultion will fail.

Thanks for that hint, Axel. I had prepared the following reply before I could study your next post. So before getting to this let me post my first reply in order to answer your question:

The problem I saw is with a time like '03:59.9'. See the steps:

1. 03:59.9 >> 03:60

2. 03:60 >> 4:00

NT strips off the leading zero here when calculating...

^!Find "([0][1-9]):60\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"

That's why I tried to resolve this by adding a leading zero to minutes from '01' through '09'

^!InsertText "0^\$Calc(^\$GetReSubStrings\$+1)\$:00"

To distinguish between '03:60' and a time like '11:45' (where a no leading 0 is needed) I wrote '([0][1-9])'.

Unfortunately, I didn't test a time like '09:59.7'. Since there is a leading 0, the clip makes it a '010:00', i.e. a surplus 0 at the beginning.

As a "quick & dirty" solution, I would try now...

^!Jump Doc_Start
:Seconds
^!Find "(\d\d)\.\d\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubstrings\$+1)\$"
^!Goto Seconds
^!Jump Doc_Start
:Minutes_1
^!Find "([0][1-8]):60\$" RS
^!IfError Skip_2
^!InsertText "0^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_1
^!Jump Doc_Start
^!Find "([0][1-9]):60\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Skip_-3
^!Jump Doc_Start
:Minutes_2
^!Find "(\d\d):60\$" RS
^!IfError End
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"

Now the list...

01:58.4
02:46.5
03:59.9
11:44.4
15:59.5
09:58
09:59.7

is changed to...

01:59
02:47
04:00
11:45
16:00
09:58
10:00

Is this OK now? I'll be back in a few hours ;-)

Regards,
Flo
• Hello flo.gehrke IN the new version of your clip, 07:03.3 becomes 07:4 with no zero. Adrian Worsfold http://www.pluralist.co.uk
Message 2 of 14 , May 24, 2013
• 0 Attachment
Hello flo.gehrke

IN the new version of your clip, 07:03.3 becomes 07:4 with no zero.

http://www.pluralist.co.uk
http://pluralistspeaks.blogspot.com
pluralist@...
24-05-2013
----- Received the following content -----
From: flo.gehrke
Time: 2013-05-24, 18:33:23
Subject: [Clip] Re: Adding a second when there's a tenth or more

[Non-text portions of this message have been removed]
• ... I think there s another issue. Please test it against... 15:59.5 09:58 09:59.7 When changing only that single command line as proposed the result is...
Message 3 of 14 , May 24, 2013
• 0 Attachment
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> > It seems to me that for 09:60 your soultion will fail.
> Just changing
> ^!Find "([0][1-9]):60\$" RS
> to
> ^!Find "([0][0-8]):60\$" RS
> will suffice and without the bother of changing everything. It deals
> with the changeover to ten and with very short clips of less than a
> minute.

I think there's another issue. Please test it against...

15:59.5
09:58
09:59.7

When changing only that single command line as proposed the result is...

16:00
09:58
09:60 <--- false

So let's combine both '[0][1-8]' and '[0][1-9]'.

We also have to take care of zeros in the seconds. It might be rare but a '10:00.1 is turned into '10.1'. Well, let's get rid of that with the last line in the next version ("hopefully mother won't see it"):

^!SetHintInfo Working...
^!SetScreenUpdate Off
^!Jump Doc_Start
:Seconds
^!Find "(\d\d)\.\d\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubstrings\$+1)\$"
^!Goto Seconds
^!Jump Doc_Start
:Minutes_1
^!Find "([0][1-8]):60\$" RS
^!IfError Skip_2
^!InsertText "0^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_1
^!Jump Doc_Start
:Minutes_2
^!Find "([0][1-9]):60\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_2
^!Jump Doc_Start
^!Find "(\d\d):60\$" RS
^!IfError Out
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"
:Out
^!Replace ":\K(?=\d\$)" >> "0" WARS

Please test it against another list:

01 xxx 01:58.4
02 xxx 02:46.5
03 xxx 03:59.9
04 xxx 11:44.4
05 xxx 15:59.5
06 xxx 09:58
07 xxx 09:59.7
08 xxx 10:00.1
09 xxx 10:09.1
10 xxx 10:01.3
11 xxx 12:10.4
12 xxx 07:03.3

For me, the result is now:

01 xxx 01:59
02 xxx 02:47
03 xxx 04:00
04 xxx 11:45
05 xxx 16:00
06 xxx 09:58
07 xxx 10:00
08 xxx 10:01
09 xxx 10:10
10 xxx 10:02
11 xxx 12:11
12 xxx 07:04

Regards,
Flo
• ... Yes, you are right. I included that in my last message. Flo
Message 4 of 14 , May 24, 2013
• 0 Attachment
--- In ntb-clips@yahoogroups.com, "Adrian Worsfold"<pluralist@...> wrote:
>
> Hello flo.gehrke
> IN the new version of your clip, 07:03.3 becomes 07:4 with no zero.

Yes, you are right. I included that in my last message.

Flo
• ... I haven t run any tests so far, only read and tried to understand your code. I don t see why 09:60 isn t caught by your subsequent ^!Find ( d d):60\$ RS
Message 5 of 14 , May 24, 2013
• 0 Attachment
"flo.gehrke" wrote:
> When changing only that single command line as proposed the result is...
> 09:60 <--- false

I haven't run any tests so far, only read and tried to understand your
code. I don't see why 09:60 isn't caught by your subsequent

^!Find "(\d\d):60\$" RS

It should be.

Axel
• ... There was. I have now run your clip of 15:54 h with my modification and lots of ^!Continue when stumped. You forgot the last loop and the d d Find was run
Message 6 of 14 , May 24, 2013
• 0 Attachment
"flo.gehrke" wrote:
> I think there's another issue. Please test it against...

There was. I have now run your clip of 15:54 h with my modification and
lots of ^!Continue when stumped. You forgot the last loop and the \d\d
Find was run only once. After adding
^!Goto Minutes_2
as a last line it worked fine. Looking at your later posts that error
seems to persist.

Axel
• ... Yes, I came across that too. Another loop is missing: ^!SetHintInfo Working... ^!SetScreenUpdate Off ^!Jump Doc_Start ... ^!Find ( d d) . d\$ RS ^!IfError
Message 7 of 14 , May 24, 2013
• 0 Attachment
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> You forgot the last loop and the \d\d Find was run only once.
> After adding ^!Goto Minutes_2 as a last line it worked fine.

Yes, I came across that too. Another loop is missing:

^!SetHintInfo Working...
^!SetScreenUpdate Off
^!Jump Doc_Start
:Seconds
^!Find "(\d\d)\.\d\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubstrings\$+1)\$"
^!Goto Seconds
^!Jump Doc_Start
:Minutes_1
^!Find "([0][1-8]):60\$" RS
^!IfError Skip_2
^!InsertText "0^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_1
^!Jump Doc_Start
:Minutes_2
^!Find "([0][1-9]):60\$" RS
^!IfError Skip_2
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_2
^!Jump Doc_Start
:Minutes_3
^!Jump Doc_Start
^!Find "(\d\d):60\$" RS
^!IfError Out
^!InsertText "^\$Calc(^\$GetReSubStrings\$+1)\$:00"
^!Goto Minutes_3
:Out
^!Replace ":\K(?=\d\$)" >> "0" WARS

New test list - before...

01 xxx 01:58.4
02 xxx 12:59.7
03 xxx 03:59.9
04 xxx 11:44.4
05 xxx 15:59.5
06 xxx 09:58
07 xxx 09:59.7
08 xxx 10:00.1
09 xxx 10:09.1
10 xxx 10:01.3
11 xxx 12:10.4
12 xxx 07:03.3

And after...

01 xxx 01:59
02 xxx 13:00
03 xxx 04:00
04 xxx 11:45
05 xxx 16:00
06 xxx 09:58
07 xxx 10:00
08 xxx 10:01
09 xxx 10:10
10 xxx 10:02
11 xxx 12:11
12 xxx 07:04

Have we got it now? :-(

Flo
• ... Adrian, I just had a look at this detail in your message. If it s about something like this (given only 6 time lines): Before: xxx xxx xxx 01 xxx 01:59 02
Message 8 of 14 , May 24, 2013
• 0 Attachment
--- In ntb-clips@yahoogroups.com, "Adrian Worsfold"<pluralist@...> wrote:

> ^!Set %Pos%=^\$GetTextLineCount\$
> ^!Set %Lines%=^\$GetParaRow\$
> ^!Set %Bracket%=^\$Calc(^%Pos%-^%Lines%)\$
> :LOOP
> ^!Inc %Count%
> ^!Jump LINE_END
> ^!InsertText "]"
> ^!MoveCursor -006
> ^!InsertText "["
> ^!Jump LINE_START
> ^!Jump +001
> ^!IfError END
> ^!If ^%Count% > ^%Bracket% END
> ^!GoTo LOOP
> :END
>
> That is the third clip in the sequence.

I just had a look at this detail in your message. If it's about something like this (given only 6 time lines):

Before:

xxx xxx xxx
01 xxx 01:59
02 xxx 13:00
03 xxx 04:00
04 xxx 11:45
05 xxx 16:00
06 xxx 09:58
zzz zzz

Isn't that done with one line:

^!Replace "(\d\d:\d\d)\$" >> "[\$0]" WARS

After:

xxx xxx xxx
01 xxx [01:59]
02 xxx [13:00]
03 xxx [04:00]
04 xxx [11:45]
05 xxx [16:00]
06 xxx [09:58]
zzz zzz

Possibly no loops, jumps, and cursor movements needed here.

Flo
• Hello Flo and Axel This ^!Replace ( d d: d d)\$ [\$0] WARS replaced many of my lines. I don t understand Regex and so I did it the long way with
Message 9 of 14 , May 24, 2013
• 0 Attachment
Hello Flo and Axel

This ^!Replace "(\d\d:\d\d)\$" >> "[\$0]" WARS replaced many of my lines. I don't understand Regex and so I did it the long way with head-banging on the route. But thanks for the error solved and this too.

Late it is now, but here is the usual time I do make up a CD. I'll do it for real and let you know how it goes (I haven't even chosen some of the music yet, but it will be very different from the given list).

* There is one final potential clip that hardly saves on human viewing, but one may as well push it to the logical end.

After the number, the presence of HL nnn, SF nnn, LS nn, CC nn, HW nnn, HF nnn, or NB nn indicates a hymn book (or latter no book still with numbers up to 99). Before each hymn book, and after it but not before another hymn book, there is a blank line inserted. This is to tell me to use a second CD made at a higher level of volume which people sing against. Now I am sure this is within my abilities, eventually, the complication being not wanting a blank line in between two hymns indicated by either leading code after the number.

Thus a final appearance result would be:

01 Temptations Papa was a Rollin Stone [11:47]
02 KamakawiwoOleIsrael Somewhere Over the Rainbow [04:55]
03 SheeranEd A Team [04:22]
04 PresleyElvis In The Ghetto [02:48]
05 Clannad I See Red [04:25]

06 HL 018 Kremser choir [01:27]
07 HL 070 Hanover [02:51]

08 KingCarole Youve Got a Friend [05:10]

09 HL 051 Stuttgart [01:59]

10 Debussy Claire de Lune Suite extract [02:00]

11 HL 210 Jerusalem choir [02:47]

12 CollinsPhil Homeless [04:15]
13 PineCourtney Closer to Home [03:56]
14 PineCourtney GreeneSusaye Children of the Ghetto [07:04]
15 Housemartins I'll be Your Shelter [04:52]
16 Simply Red Moneys Too Tight to Mention [04:15]

All of these are HLs but SFs are as common and the rest very occasional but available.

Automation of the WHOLE process isn't possible because nothing could guide the CD burner print to .PDF after the burn process. That's the human bit during the ^!shellwait after which the first clip works its magic. But this last part does follow regular internal rules.

http://www.pluralist.co.uk
http://pluralistspeaks.blogspot.com
pluralist@...
25-05-2013
----- Received the following content -----
From: flo.gehrke