Automating Timing via AppleScript

Full documentation on AppleScript will be coming soon. Until then, here are a few example scripts:

Pausing all tracking for five minutes

tell application "TimingHelper"
	pause tracking
	delay 300
	resume tracking
end tell

Adding a Task to a Project

set datevar to current date
set hours of datevar to 7
set minutes of datevar to 0
set seconds of datevar to 0

tell application "TimingHelper"
	add task from ((datevar)) to ((datevar) + 1 * hours) with description "foo" project (front project whose name is "ProjectXYZ")
    -- note: if there are two projects with the same names, but different parent projects, you can address them as follows:
    -- front project whose name chain is "Parent1 ▸ Child"
    -- front project whose name chain is "Parent2 ▸ Child"
end tell

Starting and stopping a Task

tell application "TimingHelper"
	set pr to front project whose name is "ProjectXYZ"
	start task with description "What you were doing" project pr for about 3600
	-- and later:
	stop current task with notification  -- if you don't want Timing to display a notification about the stopped task, remove the 'with notification'
end tell

Getting a summary of today's activities

tell application "TimingHelper"
	set usageData to get time summary between (current date) and (current date)
	get properties of usageData  -- have a look at the results of this statement to see what you can do with it
	delete usageData  -- this is required to avoid accumulating old summaries (and thus leaking memory)
end tell

Generating a Report and exporting it

set datevar to current date
set hours of datevar to 7
set minutes of datevar to 0
set seconds of datevar to 0

tell application "TimingHelper"
	set reportSettings to make report settings
	set exportSettings to make export settings
	
	get properties of reportSettings
	
	tell reportSettings
		set first grouping mode to by month
		set second grouping mode to by project
		
		set tasks included to true
		set app usage included to true
		
		set application info included to true
		set timespan info included to true
		set timespan info included to true
		set timespan info included to true
		
		set also group by application to true
	end tell
	
	tell exportSettings
		set file format to HTML
		
		set duration format to seconds
		
		set short entries included to true
	end tell
	
	save report with report settings reportSettings export settings exportSettings between datevar and datevar to "/Users/daniel/Desktop/export.html" for projects (projects whose name is "ProjextXYZ")
	
	-- these commands are required to avoid accumulating old settings (and thus leaking memory)
	delete reportSettings
	delete exportSettings
end tell