Last active
June 6, 2019 13:57
-
-
Save johndyer/4051055da5a3bbde220259f4150377b0 to your computer and use it in GitHub Desktop.
BetterTouchTool - Verse of the Day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- makes the verse two lines (use font: 11 to fit) | |
on splitLines(theText) | |
set middleChar to ((length of theText) / 2) | |
set templine2 to text middleChar through (length of theText) of theText | |
set nextSpace to offset of " " in templine2 | |
set splitSpace to middleChar + nextSpace - 1 | |
set line1 to text 1 through splitSpace of theText | |
set line2 to text (splitSpace + 1) through (length of theText) of theText | |
return line1 & " | |
" & line2 | |
end splitLines | |
-- get formatted verse from OurManna | |
on getOurManna() | |
set jsonurl to "https://beta.ourmanna.com/api/v1/get/?format=json" | |
tell application "JSON Helper" | |
set VerseData to fetch JSON from jsonurl | |
set vText to |text| of details of verse of VerseData | |
set vReference to |reference| of details of verse of VerseData | |
end tell | |
set vFull to vText & " (" & vReference & ")" | |
return vFull | |
end getOurManna | |
set verseText to getOurManna() | |
return splitLines(verseText) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment