Script 2.0
I am glad to share it now! You can find the full script in this pastebin here but I will comment on some specifics of the code. Now it runs way more reliably, saves by chapter into a folder containing the whole book. I also added Navigation on the top and bottom of the notes. Using it, I imported the Bible in a night and an afternoon
Before Running the Script
- Install Atom. Any TextEditor works but I optimised it for Atom
- Install CliClick. This tool emulates mouseclicks
What the script does
- In Safari, it opens a chapter on biblegateway.com in print view (so that there is less to clean up)
- It copies and pastes the webpage into Atom
- Using find and replace mechanisms, it deletes the additional text.
- It formats the text into an Obsidian-compatible format and adds Navigation on the top and bottom.
- It saves each chapter in a separate file and creates a new folder for each book of the bible.
Setting up to import
- Before running the code, make sure you disabled Footnotes and Headings on biblegateway.com. The script is not compatible with that.
- The script chooses the top folder in your favourites bar as the parent folder to save the book folders in. Make sure you set that accordingly.
- Set the mouse coordinates correctly. Via Command-Shift-4 you can find the coordinates. The upper coordinate is X, the lower Y.
- Clicking into the Atom text field:
set textX to 53
, set textY to 86
- Toggling Regrex search:
regX to 1121
, set regY to 674
. In Atom, press Command + F to open the search field. In the top right, find the “.*” button and set it’s coordinates.
- Pick folder to save in:
set folderX to 290
, set folderY to 201
. In Atom, press Command-Shift-A to open the “Save as”-Dialogue. Pick the coordinates of the top folder of the favourites bar.
- Creating a new folder:
set newX to 285
, set newY to 470
. In the “Save as”-Dialogue in Atom, note the coordinates of “New Folder” in the bottom left.
Commentary on the code
Options
set shutdown to false -- Do you want your Mac to shut down after importing?
set savedialog to true -- Choose if you want to display a dialog asking you to save each chapter. For longer books I found that helpful to be able to exit out. It has a timeout of 5 seconds if you don't bother picking an option.
set bigdialog to false -- Choose if you want a dialog to display after exporting a book
set dialogchosen to false -- Choose if you want a display showing you the books you're about to import
Delays
In the code, you can set the delays according to your internet connection and computing power. When choosing very low delay, I would recommend enabling the option of a dialogue to exit the program. You don’t want your Mac to be stuck on the script without being able to abort.
Abbreviations
In the “book information” list, you can pick different abbreviations.
A note on translations
I chose to import the ESV. You can pick a different translation in the code:
set translation to "ESV" -- pick your translation
Just make sure to optimise the find and replace process of deleting unwanted information.
When copying from the ESV, it copies the following blurb as well:
English Standard Version (ESV)
The Holy Bible, English Standard Version. ESV® Text Edition: 2016. Copyright © 2001 by Crossway Bibles, a publishing ministry of Good News Publishers.
Using find and replace I made sure to delete that unwanted text:
keystroke "f" using command down
keystroke "The Holy Bible, . ESV® Text Edition: 2016. Copyright © 2001 by Crossway Bibles, a publishing ministry of Good News Publishers."
delay DelayShort
key code 48 -- tab
delay DelayShort
keystroke "a" using command down
key code 51 -- delete
delay DelayMed
key code 36 using command down --enter
When copying from a different translation, you need to adjust the text to replace accordingly.
Current pitfalls
The Psalms are formatted differently to the other books. Therefore I haven’t been able to import them using the script yet. I might share a later compatible script. It has a description and allows me to jump into the first chapter.
Overview notes in Obsidian
In the navigation on the top and bottom I included a link to an overview note/MOC.
The script formats the overview notes with an underscore, so that it appears at the top of the folder. Because my navigation is more based on links and less on folder, I actually deleted the underscores in my vault. So feel free to use it to your liking
As always, feel free to reach out to me if you run into problems. I really appreciate the interest.