Skip to main content
Inspiring
March 2, 2022
Answered

Issues with 'Sort list of Bible references in Bible order' script

  • March 2, 2022
  • 1 reply
  • 980 views

I found an awesome little script here that sorts the books of the Bible in canonical order but I just now noticed a strange bug, and I'm not sure what is causing it. 😞 

Background

I am generating a Scripture Index at the back of my book in InDesign, using character styles and then Peter Kahrel's great little "Index from Character Styles" script. After I generate the Index, I end up with a list of scripture references in alphabetical order with page numbers after them like this. 

Now I need to sort this entire scripture index to be in canonical order (instead of alphabetical order). But after selecting the text and running the sorting script, I end up with this 😞 : 

The books are in the correct order, but the chapter numbers are all out of sync! 😞 I suspect that it's the page numbers that are throwing the script out of whack, but I can't verify that, and neither do I know what to do to fix it. I'm slowly learning some simple scripting in InDesign, but this script is a bit above me yet. Does anyone have any pointers for me? @Magnus Gaarde is the one who wrote the script, but I don't know if they are still around on the forums or not.

Thank you in advance if you can help me out! 

This topic has been closed for replies.
Correct answer Magnus Gaarde

The script will sort the list based on the characters in the name. 1 comes before 2 etc.

That is why the sorting will look as in your example:

Matthew 1

Matthew 10

Matthew 17

Matthew 2

Matthew 23

Matthew 4

 

The script was written tocould quickly sort a list of Bible books for a contents page or similar. It was not intended to sort an entire index.

 

If you are able to GREP your way out of adding couple of zeros to the first chapter numbers that might get the sorting right.
Like this:

 

Matthew 001

Matthew 002

Matthew 004

Matthew 010

Matthew 017

Matthew 023

 

I guess I (or somebody else) could rework the script if I had the time. But at the moment I don't have that time. Sorry.

 

I hope you find a way to work it out.

 

-Magnus

1 reply

Magnus GaardeCorrect answer
Participating Frequently
March 3, 2022

The script will sort the list based on the characters in the name. 1 comes before 2 etc.

That is why the sorting will look as in your example:

Matthew 1

Matthew 10

Matthew 17

Matthew 2

Matthew 23

Matthew 4

 

The script was written tocould quickly sort a list of Bible books for a contents page or similar. It was not intended to sort an entire index.

 

If you are able to GREP your way out of adding couple of zeros to the first chapter numbers that might get the sorting right.
Like this:

 

Matthew 001

Matthew 002

Matthew 004

Matthew 010

Matthew 017

Matthew 023

 

I guess I (or somebody else) could rework the script if I had the time. But at the moment I don't have that time. Sorry.

 

I hope you find a way to work it out.

 

-Magnus

Inspiring
March 3, 2022

Thanks so much @Magnus Gaarde for your reply. I realize that I'm probably asking more of the script than it was originally intended to do, but I wasn't even sure how it worked when I first ran across it. Now that I know how it works, hopefully a solution can be found. 🙂 Your idea about padding with zeros is a good one, I'll have to see if I can figure out some way to temporarily do that, and then remove the padding again after everything is sorted. Thanks again for your time on this; I really appreciate it!