humanDuration

April 23, 2008 in Mac OS X, Vista, Windows XP by chip

FUNCTION humanDuration -- assumes movie loaded into player 1
    set the numberformat to "##"
    put the duration of player 1 into tTotalTicks
    put the timescale of player 1 into tMovieScale
    IF tTotalTicks = 0 OR tMovieScale = 0 THEN
        return "duration unknown"
    ELSE
        put tTotalTicks div tMovieScale into totalSeconds
        put (tTotalTicks mod tMovieScale) into partialSeconds
        put "." & partialSeconds into f
        put f * (tMovieScale/100) into frames
        put totalSeconds div 3600 into tHours
        put (totalSeconds - (tHours * 3600)) div 60 into tMinutes
        put (totalSeconds - (tMinutes * 60) - (tHours * 3600)) div 1 into tSeconds
        return tHours & ":" & tMinutes & ":" & tSeconds & ":" & frames
    END IF
END humanDuration