Advanced Delay for folder actions

Hey Guys,

I have an applescript/automator mixed workflow I use to compress video and automatically upload them to the web. The problem I have is with the new H.264 codec.

In my current script, my compression software sends the new compressed video to a folder. The script reads the file size of the new video being added, and when the file size stays the same for more then 5 sec (Or the Video is compressed), the script moves on.

With the new H.264 codec, the compression software does 5-passes, or compresses it 5 times. On the first pass, the file size of the new video changes as it should. But on the next 4 passes, the file size does not change. So the script moves on before it is done compressing. Bah!

I need to change my workflow. Currently I use automator to read the file size. I need to change this to applescript to do the following:

  1. Mark the time that a file is added to my folder.

  2. Check every 5 sec to see if the file size has grown, or remains the same (or Video has finished it’s first pass).

  3. If the file size remains the same, mark the time.

  4. Subtract the intial time it was added to the folder from the time the fize size remained the same to get “X” amount of seconds.

(Basically I need the total time it took to get through the first pass on the video)

  1. Tell script to multiply that “X amount of seconds” times 4 .

  2. Tell script to wait that total amount of seconds before moving on.

This is way over my head. If you guys have any idea how to get this accomplished, or a better way of doing it, I am free to any and all suggestions. Thanks in advance guys.