Re: Turning clock format ( 01:36:30 ) into seconds ( 5790 )

21 views
Skip to first unread message

Thomas Fischer

unread,
May 6, 2013, 5:30:36 AM5/6/13
to textwr...@googlegroups.com
Hello Gregor,

this is actually a bit longer than necessary,

#!/usr/bin/env perl 
use strict; use warnings; 
#---------------------------------------- 
 
while ( <> ) {
s/<t>(\d\d):(\d\d):(\d\d)<\/t>/'<t>'.(($1*60+$2)*60+$3).'<\/t>'/ge;
print;
}

will do the job.

Looking at this I realised that you used Perl 5.12 (needed only for the "say"), and that TextWrangler doesn't recognise "say" as verb in Perl. So I'm wondering what version of Perl TextWrangler uses for the text coloring. Does anybody know how I can find out?

Best
Thomas


Am 05.05.2013 um 21:43 schrieb Gregor Knell:

Hey hey,
For anyone with an issue similar to this, this code is I'm sure a bit of a Frankenstein code but it does do the trick.


#! /usr/bin/env perl
use v5.12; use strict; use warnings;
#----------------------------------------
 
while ( <> ) {
if ( m{([[:blank:]]*<t>)(\d\d)(:)(\d\d)(:)(\d\d)(</t>)}i) {
    my $hours = $2 * 3600;
    my $min = $4 * 60;
    my $sec = $6;
    my $full = $hours + $min + $sec;
    say "$1$full$7";
} else {
print; }
}

All the best,
G


--
This is the TextWrangler Talk public discussion group.
If you have a feature request or would like to report a problem,
please email "sup...@barebones.com" instead of posting here.
---
You received this message because you are subscribed to the Google Groups "TextWrangler Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to textwrangler...@googlegroups.com.
 
 

Christopher Stone

unread,
May 6, 2013, 6:42:37 AM5/6/13
to textwr...@googlegroups.com
On May 06, 2013, at 04:30, Thomas Fischer <fisch...@aon.at> wrote:
> while ( <> ) {
> s/<t>(\d\d):(\d\d):(\d\d)<\/t>/'<t>'.(($1*60+$2)*60+$3).'<\/t>'/ge;
> print;
> }
______________________________________________________________________

Hey Thomas,

Nice tersification. :)

> Looking at this I realised that you used Perl 5.12 (needed only for the "say"), and that TextWrangler doesn't recognize "say" as verb in Perl.

Oh, you mean in the highlighting.

I believe you can specify 10.010 to enable 'say'.

> So I'm wondering what version of Perl TextWrangler uses for the text coloring. Does anybody know how I can find out?


I don't find a Perl Language Module just the following two files:

Perl Keywords.txt
PerLanguageOverrideKeys.plist

Neither specifies the origin of the syntax parser.

I think you'll need to contact support to find out: Bare Bones Software <sup...@barebones.com>

--
Best Regards,
Chris

Thomas Fischer

unread,
May 6, 2013, 11:19:19 AM5/6/13
to textwr...@googlegroups.com
Hello,

I found a strange problem when moving files between windows and am wondering if anybody else experienced the same.

The setup:
– I have two open windows in TextWrangler and open two files with the *same* name in the front window.
– Then I drag one of the files (using the *icon in the title bar*) to the open files sidebar in the next window.
– Now I would expect to have the two files in different windows, but
– the result is that both windows show the same file (the dragged one) while the other file is gone.

When I try to compare the two files I get the message:
"An unexpected error occurred while processing an Apple Event (MacOS Error code: -10000)"

Everything works as expected when I drag one of the files from an open files sidebar to the other.

When I use the title bar icon to drag a single file from one window to the sidebar of the next then both windows will show that file.

I think that dragging the title icon should have the same effect as dragging an icon from the sidebar.

Best
Thomas



Reply all
Reply to author
Forward
0 new messages