How do I run a script when a text box is updated?

I’m writing an application that includes web browser functions. As such, I’d like it to have the ability to download files. Doing so is no problem; the trouble arises in having the download window automatically appear when a downloadable link is clicked on. My application has a text field that displays the current URL. Its value is set through Cocoa Bindings. Consequently, “on action” or “on changed” don’t work, because even though the value did change, it was not as a result of direct imput from the user. What I’d like to be able to do is have a script detect when the field’s value changes, get its contents, check for several extensions (.zip, .tar, .sit, etc) in the text field’s contents, and if they are present, display the download window. If anyone knows how to do this even when the text field is not edited by hand, I would greatly appreciate it.

Where does the Binding get its value from?

If you don’t mind doing it in Cocoa, if it’s an NSTextField, you might try kicking off a script command with -textDidEndEditing.

The binding gets its value from the current URL of the webview. While I don’t mind doing it in Cocoa per se, I also have essentially no experience with it, which tends to make things a bit difficult.