if file updated then run script

I am trying to write a script which runs only when a file has been modified.

I have file a intitial.txt already existing on my desktop when this is modified and saved by an applescript running within a process i want it in turn to run another script.

This separate script would update another file on my desktop called sub.txt after a pause of 5 seconds.

It is a bit like a folder action but the file already exists.

The important thing is the second script should only be a textedit function isolated from the script.

why? because the first script is running within a process, and that process conflicts with another program i am using.

I do something similar. I use an AppleScript (in a Automator wrapper) to back up a particular file whenever it is modified.

I use Lingon (http://sourceforge.net/projects/lingon/files/), a simple interface for launchd – OSX’s program launching service. I set up a launch agent using Lingon that starts my Automator/AppleScript whenever a particular file is modified. It works great.