October 20, 2018

Script to Return Every Version of a Verse Reference from Accordance

In a conversation on the forum, someone wondered how you might include a script to do a multi-version lookup. The idea is to take a verse reference and show a result that gives that text in every relevant version you have installed in Accordance.
Here is an example of how to do this.

multiModuleVerseLookup("John 2:1", true)

on multiModuleVerseLookup(theReference, quoteAsCitation)
-- set the delimiter between versions
set theDelimiter to return & "----------" & return
-- get moduleList
tell application "Accordance" to set moduleList to «event AccdVerL»
-- prepare textResult
set textResult to theReference & theDelimiter
repeat with thisModule in moduleList
-- lookup theReference in each module
tell application "Accordance" to set thisResult to «event AccdTxRf» {thisModule, theReference, quoteAsCitation}
-- add the result if the module contains theReference
if thisResult does not start with "ERR-" then set textResult to textResult & thisModule & return & thisResult & theDelimiter
end repeat
return textResult

end multiModuleVerseLookup


The results would look like:

"John 2:1
----------
GNT28-T
  Κα τ μέρ τ τρίτ γάμος γένετο ν Καν τς Γαλιλαίας, κα ν μήτηρ το ησο κε· — John 2:1
----------
CEB
  On the third day there was a wedding in Cana of Galilee. Jesus’ mother was there, and — John 2:1
----------
NRSVS
  On the third day there was a wedding in Cana of Galilee, and the mother of Jesus was there. — John 2:1

----------


It is self-explanatory for those who do any Applescripting. You could include it in an Automator workflow, etc.
Here is a simple complete script that when called from Quicksilver/Launchbar/a Workflow/etc. would bring up a dialogue box and then open the result in a TextEdit window.

-- use a display dialog to ask for valid verse reference
set dd to display dialog "Enter a valid verse reference:" default answer "John 1:1"
set theReference to text returned of dd
multiModuleVerseLookup(theReference, true)

on multiModuleVerseLookup(theReference, quoteAsCitation)
-- set the delimiter between versions
set theDelimiter to return & "----------" & return
-- get moduleList
tell application "Accordance" to set moduleList to «event AccdVerL»
-- prepare textResult
set textResult to theReference & theDelimiter
repeat with thisModule in moduleList
-- lookup theReference in each module
tell application "Accordance" to set thisResult to «event AccdTxRf» {thisModule, theReference, quoteAsCitation}
-- add the result if the module contains theReference
if thisResult does not start with "ERR-" then set textResult to textResult & thisModule & return & thisResult & theDelimiter
end repeat
-- display the result in a new TextEdit document
tell application "TextEdit"
activate
set textDoc to make new document at the front
set the text of textDoc to textResult
end tell
end multiModuleVerseLookup



September 27, 2018

Siri Shortcut Verse Lookup in Accordance

Here is a proof-of-concept video demonstrating that we're getting close to voice verse lookup. The problem right now is that you have to spell out the reference: “romans twelve colon three hyphen seven”.





With some work, a javascript shortcut could be made to take a normal string like “romans twelve three to seven” and format it properly into "Romans 12:3-7".