Importing a List of Projects from a File

A newer, JavaScript-based variant of this script is available. We recommend using that one instead.

Simply copy the following script(s) into a new "Script Editor" document and press run.
After pasting them, consider saving the scripts to disk for future re-use. You could even save them to iCloud Drive (or e.g. Dropbox or Google Drive) to have them available on all your Macs.
Feel free to customize them for your use cases; if you need details on how a particular method works, please refer to our AppleScript reference.

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) 2024 Timing Software GmbH. 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.
tell application "TimingHelper"
	if not advanced scripting support available then
		error "This script requires a Timing Connect subscription. Please contact support via https://timingapp.com/contact to upgrade."
	end if
end tell
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

set listFile to ((choose file with prompt "Please select a list of projects to process:") as string)
set importedProjectNames to paragraphs of (read file listFile as «class utf8»)

repeat with projectName in importedProjectNames
	get (projectName)
	if projectName as string is not "" then
		getOrCreateProject(projectName, missing value)
	end if
end repeat

Take our free 5-day course to get started with Timing.