Stepping off the hedonic treadmill – why we are rarely satisfied
An in-depth exploration of hedonic adaptation and practical strategies to overcome the cycle of diminishing returns from pleasure-seeking behaviors. read more
This guide is written for Things on MacOS. There is a way to get your database on iOS or iPad. However, I can't guarantee the script will work with it.
Before you can use the script, you need to locate your Things 3 database:
Make sure you have Python installed on your Mac. You can find instruction on installing Python here.
things2plaintext.py. I recommend saving it in the same directory as your main.sqlite.python things2plaintext.py.main.sqlite.If you encounter any errors, ensure that the database path is correct and that the right Python is installed. Raise an issue on our Github, when you are stuck.
I hope this helped making your tasks more resistent to time.
import sqlite3
import os
def get_database_path():
return input("Enter the path of your Things 3 database (main.sqlite): ")
def choose_export_format():
choice = input("Choose export syntax (1 for Markdown, 2 for todo.txt): ")
return 'markdown' if choice == '1' else 'todo.txt'
def connect_to_database(path):
try:
return sqlite3.connect(path)
except sqlite3.Error as e:
print(f"Error connecting to database: {e}")
return None
def fetch_tasks(cursor):
query = """
SELECT title, status
FROM TMTask
WHERE trashed = 0 AND status IN (0, 3, 2)
"""
cursor.execute(query)
return cursor.fetchall()
def task_status(status):
return {
0: 'Not Yet Done',
3: 'Done',
2: 'Canceled'
}.get(status, 'Unknown')
def format_task(task, format_type):
title, status = task
# Define the status markers and prefixes
status_markers = {
0: ('', ''), # Not Yet Done
3: ('x ', ''), # Done
2: ('x ', 'canceled ') # Canceled
}
# Get the appropriate marker and prefix for the task status
marker, prefix = status_markers.get(status, ('', ''))
if format_type == 'markdown':
return f"- [{marker.strip()}] {prefix}{title}\n"
else: # todo.txt format
# Only add a space after the marker if it's not empty
space = ' ' if marker else ''
return f"{marker}{space}{prefix}{title}\n"
def main():
db_path = get_database_path()
export_format = choose_export_format()
connection = connect_to_database(db_path)
if connection:
cursor = connection.cursor()
tasks = fetch_tasks(cursor)
tasks = [(title, status) for title, status in tasks if title.strip()]
with open("exported_tasks.txt", "w") as file:
for task in tasks:
file.write(format_task(task, export_format))
print("Tasks exported successfully.")
connection.close()
if __name__ == "__main__":
main()
Know someone who'd geek out over this? Share this post.
An in-depth exploration of hedonic adaptation and practical strategies to overcome the cycle of diminishing returns from pleasure-seeking behaviors. read more
I wondered: is music hurting my understanding of what I read? Being a curious boy, I decided to investigate. I pulled up my trusty research tools and went to theory town. How does background music impact my brain? I asked in science speech.... read more
We’re tackling what seems like a really basic question: What is music? Everyone intuitively knows ‘what music’ is, right? Well, as it turns out, it is really hard to pin down one definitive answer. Philosophers and scientists have been rack... read more