Detecting "Save" or "Save-As" for timestamp

I have a client who wants scripting done to allow the AUTIOMATIC creation/updateing of a timestamp message or text in documents from InDesign, Illustrator and Quark. They can’t trust the operators to update this (they may forget) so they want a script to handled this.

I’m thinking there will have to be some sort of background task running to “watch” for any "Save or “Save-As” commands from these applications. Once detected, an Applescript could be triggered to create or update text in the slug area outside the margins of the document before the final save.

Being new to ApplesScript (been programming a =long= time) I’m not sure where to start looking to catch the “Save” operation. Would this be possible thru AS or will I need to do an Xcode app of some sort? Does AppleEvents provide some messages about applications activites like doing a close or save?

Any clues to help this clueless noob greatly appreciated!

=Alan R.

Model: PowerPC G5
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

I don’t own any of those apps, but assuming that documents being worked on equate to window titles somehow, then your stay-open app can find out what is being worked on, and find the file it came from if it has ever been saved before. The Finder will tell you the modification date (where you wouldn’t choose the file, you’d know it):

set f to choose file
tell application "Finder" to set m to modification date of (info for f)

If, when a window goes away, the modification date doesn’t change, you can reopen the file with a message or force something into the file.

An “idle” handler, saved as a stay-open application, goes like this:

on run
	-- do stuff - this runs when the application is started from the Dock or Finder. 
	-- Here you could create a list of all the open files and their modifation dates.
end run

on idle
	-- In this section, you periodically check names and dates and compare them in a repeat loop. If one has changed you do your thing.
	return 60 -- do this every 60 seconds or whatever timing is acceptable
end idle

on quit -- optional
	-- do stuff - assumes something in the idle handler would cause the application to quit from within or that you want to clean up before quitting.
	continue quit -- absolutely essential if you use a quit handler because you have trapped the "quit" message
end quit