Importing Things Projects

Simply copy the following script(s) into a new "Script Editor" document and press run.
Feel free to customize them for your use cases.

Note: We do not take responsibility for any data loss incurred by running these scripts.
Make sure to back up your data (e.g. by copying the directories mentioned here to a different location) before running these scripts.

-- Copyright (c) 2017 timingapp.com / Daniel Alm. All rights reserved.
-- This script is licensed only to extend the functionality of Timing. Redistribution and any other uses are not allowed without prior permission from us.

set alertResult to display alert "Please back up your data!" message "Before proceeding, please make sure to back up your Timing database.\n\nSee https://timingapp.com/help/faq#data on which folders you need to back up." buttons {"Cancel", "I Have A Backup"}
if button returned of alertResult is "Cancel" then
	error number -128
end if

on getOrCreateProject(projectName, parentProject)
	if projectName = "" then
		return missing value
	end if
	
	tell application "TimingHelper"
		if parentProject is missing value then
			set results to (projects whose name is projectName)
			if results = {} then
				return (create project name projectName)
			else
				return (first item of results)
			end if
		else
			set results to (projects of parentProject whose name is projectName)
			if results = {} then
				return (create project name projectName parent project parentProject)
			else
				return (first item of results)
			end if
		end if
	end tell
end getOrCreateProject

tell application "Things3"
	set importedProjectNames to name of projects
end tell

repeat with projectName in importedProjectNames
	getOrCreateProject(projectName, missing value)
end repeat