Converting some text files (Any help appreciated)

I am a little new to some of the Applescripting stuff. I have made a few little applications before but nothing too complicated. What a I am looking to do is take a text file that has data arranged like this:

00:05:13.00<tab>00:05:16.04<tab>The Loyalist Committee<P>has arrived, Your Honor. 01:04:37.12<tab>01:04:40.00<tab>Let me help you with that.
and convert it to code that looks like this:

$FontName = Arial $FontSize = 65 //The following subtitles are for scene one. 00:05:13.00 , 00:05:16.04 , The Loyalist Committee<P>has arrived, Your Honor. 01:04:37.12 , 01:04:40.00 , Here we see them bring down a moose.
Those tabs are not actually written in the document like that but they represent there are tabs there.

I have access to BBEdit which i think may help.

I am not looking for someone to write the code for me, but just a little direction on how to even start working on this. Thank you all and I hope someone can help!

Okay not too diffcult, but I like that you asked for advice rather than the answer. To do what you’re looking for you don’t need BBEdit at all. What you need to use are Text Item Delimiters and reading/writing with AppleScript. Do some searches round the board :smiley:

Ok for some reason i am completely blanking on how to do this, I guess i have never written a script that involves opening a file and changing its contents (i wrote some HD mounting scripts). So i think i am going to break this down into its parts that i am going to need help with:

Part 1: Opening the original File
From what i understand, it looks like i am going to want to use the open for access command. The one thing i would like to be able to do is have a Open File dialog window come up where i can point to the file. I dont know if i need to use Automator for this basic function or if i am going to have to make a GUI with the developer tools.

Part 2: Processing Time Code
Well, since my first post i have decided i would like to make an all purpose tool so my original formatted text has changed from the first post here. The original format now looks like this:

00:00:32,410 → 00:00:34,537
There was a time…

00:00:34,645 → 00:00:37,614
when the fierce and beautiful
land of AlagaÃŽsia…

00:00:37,715 → 00:00:41,811
was ruled by men
astride mighty dragons.
So I need to accomplish 2 things in this step:

A. Converting the time code from hh:mm:ss,ms to hh:mm:ss:fr
I believe the formula that i need to use looks something like this:

[code]1000 milliseconds = 1 second = 30 frames

1 frame = 1000ms / 30fps = 33.33mspf[/code]
I could be wrong though

One of the problems i see here that i am going to have to deal with is either converting the whole time to ms or rounding just the seconds part up basaed on the frame number (anything over 30 would have to round the seconds up by one)

B. Formatting the text from its original state to the new state as posted in the first post
I have done some searching and i am still not sure how to use the Text Item Delimiters as well as reading and writing. Also I dont know how tell the script that the number followed by a return (1 [return]) is the start of a new timecode lline.

Part 3: Saving the file
This one seems like it will be easy, I would like to have a dialog box that allows me to select a save location and a save name.

I am pretty sure that this project is going to be way out of the realm of applscripting alone. If it is too hard to do the formatting of the time code I would like to just use my source code posted in the original post. This means that i really only need a little more guidence on Part 1, and Part 2b (the Text Item Delimiter and replacing text steps).

Thank you in advance again.