Hi Steve,
Wow, thanks for that script. It does exactly what I need it to do. I truly appreciate your help!
Keith
Steve King-8 wrote:
Of course, search and replace isn't the right tool for the job. :-) Here's a little Python script that you can save as a bundle command. Set the input to "Selected Text or Document" and the output to "Replace Selected Text". This script has the benefit of rounding values (0'12.9999 becomes 00:13:000) and dealing with pathological cases (0'99.1234 becomes 01:39.123).
#! /usr/bin/env python import re import sys regex = re.compile(r"^(\d+)'(.*?)\s+(Start|End)$") for line in sys.stdin: mo = regex.match(line.strip()) if mo: ms = round((int(mo.group(1))*60.0 + float(mo.group(2))) * 1000.0) mm = int(ms/60.0/1000.0) ms -= mm*60.0*1000.0 ss = int(ms/1000.0) ms -= ss*1000.0 print '%02d:%02d:%03d'%(mm,ss,ms)
-- Steve King