You are browsing the archive for human.

by chip

HMSfromSec

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

FUNCTION HMSfromSec totalSeconds, tDisplay
  put totalSeconds div 3600 into tHours
  put (totalSeconds - (tHours * 3600)) div 60 into tMinutes
  put (totalSeconds - (tMinutes * 60) - (tHours * 3600)) div 1 into tSeconds
  IF tDisplay = "hhmmss" THEN
   set the numberformat to "##"
   return tHours & ":" & tMinutes & ":" & tSeconds
  ELSE
   set the numberformat to "#"
  IF tHours = 1 THEN
   put tHours && "hour, " into tDuration
  ELSE IF tHours > 1 THEN
   put tHours && "hours, " into tDuration
  END IF
  IF tMinutes = 1 THEN
   put tMinutes && "minute, " after tDuration
  ELSE IF tMinutes > 1 THEN
   put tMinutes && "minutes, " after tDuration
  END IF
   put tSeconds && "seconds" after tDuration
   return tDuration
 END IF
END HMSfromSec 

by chip

humanSize

April 24, 2008 in Mac OS X by chip

FUNCTION humanSize theCurrentFileDetail

  put item 2 of theCurrentFileDetail + item 3 of theCurrentFileDetail into tSize

  IF tSize > 1000000 THEN

    set the numberformat to "#.##"

    return tSize/1000000 & " MB"

  ELSE

    set the numberformat to "#"

    return tSize/1000 & " KB"

  END IF

END humanSize

by chip

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