Help with Textedit and AppleScript

Discussion in 'Mac Programming' started by yoblanco, Sep 4, 2012.

  1. yoblanco macrumors newbie

    Dec 10, 2011

    I have a small problem. A subtitle file I have does not sync with the video file. And I think (I have no idea of AppleScript) it would be easy to write a script to change all the seconds of the .srt file (which are in this format: 00:00:00,000 where you find hh:mm:ss,millesimals). Would it be really easy? In that case, could you tell me where can I ask somebody to write it for me?

    The idea I have on my mind is the next:
    — First you should easily change the 'date format' (i.e. hh:mm:ss instead of hh:mm:ss,millesimals)
    — Then you should easily say hoy many seconds/minutes/hours/millesimals you want to push forward/backward
    — And finally the script would push forward/backward all the 'dates' of the .srt file.

    Sorry about my english, but at this moment I realize I am terrible writing in English, I really understand almost everything but writing is other thing.

    Thank you so much in advance
  2. kryten2 macrumors 6502a

    Mar 17, 2012
    You can :

    • Search for a subtitle file that's in sync with the video.
    • Use software that will try to sync your subtitle eg SubFix and other programs.
  3. robbieduncan Moderator emeritus


    Jul 24, 2002
    What is the exact format of a .srt file? Might be possible with sed or awk on the command line. But the addition of seconds might prove a problem as they will do dumb addition allowing, say, 61 seconds. Maybe perl would be better...
  4. yoblanco, Sep 4, 2012
    Last edited: Sep 4, 2012

    yoblanco thread starter macrumors newbie

    Dec 10, 2011
    @kryten2 thank you for the answer, I didn't know that program. But I would like to see an script doing so.

    @robbieduncan That's the idea, the script should autocorrect that things (like you said, 61 seconds and more). Should it be possible to make it in AppleScript? You're probably right and it's easier to do it with perl, but as I don't know any of those languages, I'm looking for an AppleScript script (and a place, maybe out of macrumors, to ask for it).
    If I find it easy to do it under AppleScript I will start learning that language (just because this is the first thing I've found that I think could be done under AS).

    Thank you both.

Share This Page