An AppleScript for Using a Different Font for Drafts

I like to work with a Garamond font (Garamond Premier Pro, actually) in Scrivener, but just about everything I write with Scrivener has to be in Times when it is turned in as a Word file. (I thought there was a way to do this automatically in an earlier version of Scrivener, but I haven’t been able to find it recently.) Anyway, this font substitution wouldn’t be such a big deal if I were only doing it when I had finished my document – but I am very finicky about how I work. I want to be able to compile a draft and then see the actual format of the finished product in Word. Every. Few. Minutes.

I had developed a manual workflow where I would drop the RTF file created when I compile a draft onto the BBEdit icon and change the font in the file from Garamond to Times New Roman. Then I would close the file in BBEdit and drop it on the Word icon. For someone of my fairly picky nature, the extra steps were worth it.

But I finally got lazy enough to write an AppleScript that substitutes Times for Garamond and opens the file in Word. I thought I would pass on the script in case any other fanatics might want to give it a shot. So here it is. I hope it is useful for some people – and if there actually is a bona fide built-in way to do this with Scrivener, I can only blush…

on open my_draft_file
tell application “BBEdit”
open item 1 of my_draft_file
activate
replace “GaramondPremrPro” using “TimesNewRoman” searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
save text document 1
close text document 1
end tell
tell application “Microsoft Word”
close every document
open item 1 of my_draft_file
activate
end tell
end open

You can save this script as an application in the AppleScript Editor and then drop your RTF file on its icon in the Finder. The RTF file will open up in Word and everything will be in Times New Roman.

Unless you use the same fonts I have used here, you will need to rename them in the replace command. Likewise, if you use a text editor other than BBEdit and a word processor other than Word, you will have to modify the script to take that into account. And if you use more than one font in Scrivener, you will have to have a separate replace statement for each font.

Richard

In 2.x, when you select “compile”, click the triangle disclosure button if you don’t see a big pane with lots of options. Make sure in the Content pane none of the documents are checked “as-is” and in the Formatting pane check the box to “override text and notes formatting”, then set the font in the sample editor to TNR for each of the relevant file types.

The predefined “format as” selection “Times 12pt with Bold Folder Titles” is already set up for compiling to TNR, so you may just want to start with that and then tweak it as necessary.

Thanks for the tip!

I also had to set the font size to 12 points, but the method you described seems to have retained the other formatting, including my double spacing. I really do appreciate it!

(And I guess I need to blush after all!)

Here’s hoping that my AppleScript proves useful to someone, somewhere, somehow… :wink:

Richard