Application Timer

Hello all. I would like to have an applescript to track my progress in an application over the course of any given day. I would like a script that will begin when I open a document in QuarkXPress, time my activity on the open document, get the file name, date and time, close the document. Then export my progress on every document at the end of the day. Is this too much to ask for? All and any input will be greatly appreciated.

Model: iMac 2.66 GHz Intel Core 2 Duo, 4GB 800 MHz
AppleScript: 2.0.1
Browser: Safari 528.16
Operating System: Mac OS X (10.5)

Hi,
the script below needs to be saved as an application from Script Editor. This will allow you to either drop a Quark file on it or double click the application script to choose a file. When the Quark file you dropped or chose is closed it will generate a report in the same location as the Quark file. As long as you keep the report in the same location as the Quark file, each time you drop/choose the same Quark file it will append to the report.
Hope this is what you’re looking for!!!

on run
	set source_file to choose file
	my job_track(source_file)
end run

on open this_file
	set source_file to this_file as alias
	my job_track(source_file)
end open

on job_track(source_file)
	tell application "Finder"
		set start_time to current date
		set filename to name of source_file
	end tell
	tell application "QuarkXPress"
		activate
		open source_file
		set doc_name to name of document 1
		set file_path to file path of document 1
		set file_open to true
		repeat until file_open is false
			delay 10
			if not (exists document doc_name) then
				set file_open to false
				set closed_time to current date
			end if
		end repeat
	end tell
	set timeDiff to closed_time - start_time
	set hrDiff to timeDiff div 3600
	set timeDiff to timeDiff mod 3600
	set minDiff to timeDiff div 60
	set secDiff to timeDiff mod 60
	set active_time to "Time elapsed: " & hrDiff & " Hours " & minDiff & " Minutes " & secDiff & " Seconds"
	set report_content to "Filename: " & filename & return & "Start time: " & start_time & return & "Closed time: " & closed_time & return & active_time & return
	set posix_file_path to quoted form of POSIX path of file_path
	do shell script "echo " & report_content & " " & ">> " & posix_file_path & "_job_track.txt"
end job_track

Thanks,
Nik

Many thanks! This is wonderful! Thank you for your time and effort… this is going to help me a great deal.

Model: iMac 2.66 GHz Intel Core 2 Duo, 4GB 800 MHz
AppleScript: 2.0.1
Browser: Safari 528.16
Operating System: Mac OS X (10.5)