How to exempting projects from being archived?

I use OF2 for my groceries list, packing lists etc, unchecking items as incomplete when I need to reinstate them. If I archive my database, such items are removed from the main database, as they are both older than the cutoff date and completed.

I’d like to be able to mark a project as exempt/do not archive - how can I do this?

You could try marking the project as ‘On Hold’ rather than complete. Otherwise, leave it complete and restore it from the archive (File > Open Archive… [I think that’s what the menu item is called]). You might be able to drag the project back into the database (I tried once, but wasn’t able to), but you could cut and paste it.

I think if a project has a repeat set it will not archive.

You can use AppleScript to work through these projects and modify the completed date for each completed action so that it doesn’t get moved to the archive.

The following script should work, you have to edit the first line so that it matches your own project names.

set projectList to {"Groceries", "Packing List"} -- add names of further Projects here

tell application "OmniFocus"
	tell front document
		set DateTreshold to (current date) - 14 * days
		set NewCompletionDate to (current date) - 7 * days
		repeat with myProjectName in projectList
			set myProject to flattened project myProjectName
			set completedTasks to (every flattened task of myProject where completion date is less than DateTreshold)
			repeat with myTask in completedTasks
				set completion date of myTask to NewCompletionDate
			end repeat
		end repeat
	end tell
end tell

I have wished for YEARS that OF would have a robust, manual Project-centric method to archive content in addition to the existing “black-box” automatic Time-centric method. It would solve this type of problem immediately.

FWIW, you can ignore automatic archiving entirely and archive manually (as I do). The manual method is error-prone, tedious, and has ongoing problems even since OF1, especially with a duplication of empty hierarchical folders in the archive (frustrated 😣).