How to export all your scripts as Fountain files

Keep a copy of every script in a folder you own, as plain text that opens without Scriptroom.

Can I export all my scripts at once?

Yes, with the short program below. The Export menu does one script at a time. The program uses the API to save every script to a folder as a Fountain file. Run it again and it replaces each file with the script as it is now.

Make an API key first. Then save this as backup.py in the folder where you want your scripts, and run python3 backup.py (on Windows, py backup.py). Replace YOUR_KEY with your key.

These examples use Python 3, which you may need to install first.

backup.py
import json, os, re, sys, time, urllib.error, urllib.request

KEY = "YOUR_KEY"
BASE = "https://www.scriptroom.app/api/v1/scripts"

# Save the scripts beside this file, even when cron runs it.
os.chdir(os.path.dirname(os.path.abspath(__file__)))

def get(url, accept):
    time.sleep(1)  # stays under 60 requests a minute
    req = urllib.request.Request(url, headers={
        "Authorization": "Bearer " + KEY, "Accept": accept})
    try:
        with urllib.request.urlopen(req) as res:
            return res.read()
    except urllib.error.HTTPError as e:
        if e.code == 401:
            sys.exit("Scriptroom didn't accept your key. "
                     "Check that you replaced YOUR_KEY with your key, "
                     "and that the key hasn't been revoked.")
        raise

for script in json.loads(get(BASE, "application/json"))["scripts"]:
    url = BASE + "/" + script["id"]
    text = get(url, "text/x-fountain").decode("utf-8")
    name = re.sub(r"[^\w\- ]", "", script["title"])[:50].strip()
    name = (name or "Untitled") + " " + script["id"] + ".fountain"
    with open(name, "w", encoding="utf-8") as f:
        f.write(text)

How do I export one script as Fountain?

Open the script, choose Export, then Fountain. Final Draft, PDF and plain text are in the same menu. It works on Free and Paid, and if you stop paying you can still export every script.

My scripts are in Final Draft. Can I get them as Fountain?

Yes, with the free FDX to Fountain converter, one .fdx file at a time. It runs in your browser and needs no account.

Why keep a Fountain copy of my scripts?

So you have a copy that opens without the app you wrote it in. Fountain is plain text, so any text editor opens it, and so do Highland and Arc Studio. Keep two copies in two places: put the folder in Dropbox, iCloud or Google Drive and it leaves your computer too.

Can I export my scripts automatically?

Yes, if you schedule it on your own computer. Run the program above with cron on a Mac, or Task Scheduler on Windows. On a Mac, if the folder is in Desktop, Documents or Downloads, give cron Full Disk Access in System Settings, under Privacy & Security, or the scheduled run can’t save there. Scriptroom doesn’t run backups for you.

Does Scriptroom keep old versions of my script?

Yes, when you save one. Choose File, then Save version. Scriptroom also keeps one before you restore an old version. When the API changes a script’s text, it keeps one first, at most one every ten minutes. It doesn’t save versions as you type. Versions are on Free and Paid. They live in your account, so they aren’t a backup. Keep your own copy as well.

Where are my scripts kept?

In your Scriptroom account, so you can open them on any device. A script you start without signing in is saved in that browser only, until you keep it in your account.

What happens to my scripts if I stop paying?

They stay. You can open them and export every one. On Free you can’t add a script while you have three or more.