Click here for Done Deal Pro home page

Done Deal Pro Home Page


Go Back   Done Deal Pro Forums > General > Sites, Services, Software, & Supplies
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 06-17-2019, 10:08 PM   #1
Join Date: Apr 2009
Location: Idaho
Posts: 1,932
Default Using Shell Scripts with Fountain

I'm wasting time with shell scripts. Actually, it saves a lot of time in the long run (if I was actually writing screenplays in Fountain format).

Here's a link to a video showing a short Fountain file being into six slightly different PDF files, using six shell scripts. (There is no sound in the videos and it will be evident that I don't do this very often.)


Now the explanation ...

Assuming you've written a short screenplay using your favorite editor in Fountain format and you want to produce a PDF from the Fountain file. And (for some inexplicable reason) you wanted to do this without a GUI program using the shell (or CLI) of your OS.

There are (at least) three CLI utilities that will let you do this. "Afterwriting, ScreenPlain and Wrap. Because I'm obsessed with Fountain, I've installed all three utilities on my Linux desktop and laptop and experimented with each of them.

Screenplain is written in Python and uses Courier New as its default font. At this point I don't know how to change the font, but it can be done (I think). It also comes with a "Strong" option which bolds and underlines the Scene Headings. I DO know how to change that go into Screenplain's export folder and edit the file (since the file is commented, it's pretty easy to find). You can also change the double space for headers to single space, by editing the same file ("slug_style" at "space_before" from "24" to "line_height"). Screenplain CLI will also convert Fountain files into Final Draft (.fdx) files or HMTL files.

'Afterwriting is written in Java and defaults to Courier Prime. It uses a "--config" option that, if you don't want to use A4 paper, is mandatory. The file's default name is "config.json" and the 'Afterwriting GIT site shows how to write it with copy and paste (actually write "them" as you can have multiple configuration files). The config file does everything (or just about everything) that the Settings on the online version will do. For me, the main changes I've made were, turn off printing Title page, using "usletter" instead of A4 and turning off bold Scene Headings and changing to single space for them. But I also have another configuration file for Bold Slugs (and could have many more). So far I haven't been able to get the "--fonts" flag to work. I want to try it with Courier Screenplay at some point.

Wrap is written in (I believe) Go. I don't know how to tweak it, so it defaults to two spaces before Scene Headings and no bolding (unless you put it into your Fountain files yourself). It also defaults to Courier Prime. I HAVE been able to use its font option to use Courier Screenplay, so (currently) I have two Wrap scripts, one for Courier Prime and one for Courier Screenplay. Wrap will also output to HTML (but not Final Draft).

Now why the Shell Scripts?

Because the lines to run these utilities can look like ...

afterwriting --source filename.fountain" --pdf --config /home/ronb/afterlabs/config.json --overwrite screenplain --strong filename.fountain" filename.pdf" wrap pdf filename.fountain" --font "CourierScreenplay.ttf, CourierScreenplay-Bold.ttf, CourierScreenplay-BoldItalic.ttf, CourierScreenplay-Italic.ttf"
(I've also written shell scripts that allow me to change the name of the output instead of overwriting my old files.)

Not only do the Shell Scripts save you from typing in all of the options each time, they also automatically move me to my scripts folder add in the right extensions when reading the file and they output to right file extension.

And so much for that.

The second video shows a "OneStep" method of changing a Fountain file into a formatted text file (for pasting to various forums). It should be self-explanatory ...

If any of you have made it this far ... thanks for reading (and watching).

Here's a "printout" of a couple of the shell scripts used here. These are pretty simple which is a mandatory requirement if I'm writing them.

#!/bin/bash cd /home/ronb/Documents/scripts echo "-------------------------- This script uses Screenplain and outputs to single-spaced, bold slugs, using Courier New. --------------------------" read -p 'file: ' uservar screenplain --strong $uservar".fountain" $uservar".pdf" echo
#!/bin/bash echo "----------------------------------------------- This shell script does the following: 1) Changes to the folder where my Fountain scripts are stored, 2) Reads in the name of the file (adds the extension), 3) Runs Screenplain to 'compile' the Fountain file into a PDF, 4) Runs pdftotext (with layout and nopgbrk options) to create formatted text file, 5) Uses sed to prepend five spaces in front of each line of the formatted text file (to give a margin on the left side) and 6) Renames the '.txt.' file created by sed (as a backup) to '.text'. You end up with four files. The original Fountain file, a PDF file, the formatted text file with a left margin and the one without the prepended spaces. The PDF file could be deleted, as could the '.text' file. (Actually the '.text' file would not be created at all if you did not use the dot bethind the '-i.' option in sed.) -----------------------------------------------" cd /home/ronb/Documents/scripts read -p 'file: ' uservar screenplain $uservar".fountain" $uservar".pdf" pdftotext -layout -nopgbrk $uservar".pdf" $uservar".txt" sed -i. 's/^/ /' $uservar".txt" mv $uservar".txt." $uservar".text"
STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.
Centos is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

All times are GMT -6. The time now is 06:14 PM.

Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Done Deal Pro

eXTReMe Tracker