How Can I Grab a Bible Verse from BibleGateway and Paste It into the Application the Macro Was Triggered from?

I am new to KM and am getting used to some of the basic functions. not sure if I have come to the right place to post a question for a macro I am trying to build.

I want to be able to type a Bible reference (e.g. John 3:16) in an application (Evernote, word, pages, mail) and then use a macro to grab the verse (the text of the verse only - not the title or reference) from Bible gateway ( and paste this back into the application I triggered the macro from (i.e. Evernote, word, pages, mail)

I have been able to Automate the following

  • I type the bible reference e.g. ‘John 3:16’ (in an application such as Evernote, word, pages, mail)
  • I then type the string ‘.bg'
  • which then executes the following
  • this gets me to the point where I have the desired Bible verse on Bible Gateway in a safari window.

What I can’t do is to automate the selection of the verse, copy it and then paste it back into the app I typed the original string in (i.e. Evernote, word, pages, mail). Two things I don't know how to do

  1. I don't understand how tokens java, script, and html works and therefore don't know how to construct an action for this
  2. I don't know how to then copy this back into the originating application.

What result do you want from the web page? For example, the web results are:

Text includes:

John 3:16 New International Version (NIV)

16 For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.

What specifically do you want the result to look like? Just the quote (“For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.”) because that is relatively easy because it appears in the meta fields in the web page.


That action can actually paste directly in.

But if you want the book and chapter/verse, that would have to be extracted too. And there may be a limit on how long text they put in the description.

1 Like

I wanted the simple option as you suggest - just the text of the verse without title or reference.

I have added the action that you have provided, but the words of the verse are not pasting back into the the application I typed the trigger from - probably missing something obvious. Here a screenshot of the macro:

As always with KM, there will be many ways to do what you are trying to do. I'm still learning, but this macro works for me. I made it close the window when finished. Basically, rather than display the results in a window, you save them to a variable, and paste that back into your Evernote. I don't use Evernote, so I did it for word. You'll need to change the hotkey to your typed string also.

You could also use the 'Activate Last Application' so it wouldn't matter if you were using word or evernote or whatever.

Keyboard Maestro Actions.kmactions (5.9 KB)



Thanks for response. Have tried this but it gets stuck at wait for safari to finish loading. The window has loaded but the macro does not progress to the next action - any thoughts why this might be?

I am getting the same stall in my other macros that wait for loading. Safari has ended its progress of loading (apparently) successfully, but the KM debug says that "wait for Safari to finish loading" has not yet completed. Will be interested to see what others suggest.

It may be that there is an element of the website that isn't completing. The macro works for me, but I have fibre broadband, so it's very quick. Off the top of my head you could either try a fixed time pause, experimenting with the time, or you could use an 'if then' action with the condition being 'find image on screen' to continue the macro.

I'm not a web expert, but I think it's very possible that since the javascript takes the results from the head of the html page, it would be one of the first things that loaded, so a simple 2 or 3 second delay may work, depending on your net connection. I'm sure others may have some ideas too. Hope that helps.

The Wait For Safari action was broken by a recent Safari update. See:

for various solutions (or just use a Pause action).

Great - this is now working for me. Is it possible to have a generic macro that will work across different apps - preferably that would paste the verse into the application that was being used when the macro was triggered? I would generally use this macro across Pages, Evernote and Mail. If not I will duplicate the macro and create one for each application. Thanks.

1 Like

Replace the 'Bring Front Window to Front' action with 'Activate Last Application' and that should do the trick. Let us know if you're still having trouble, but it's worth messing around and trying it yourself! Before you know it, you'll be using KM for a lot of other things. :slight_smile:

1 Like

All working now - thanks for your help.


Great macro, thanks!

1 Like

Yes, I realise this thread is old, but it has already been revived...

A URL request like would also work, rather than waiting for Safari to open, filling the URL bar, and then loading the page. It would take out some steps and potentially reduce the chance for errors. This is likely to work for many situations where a created macro is currently opening a browser and then getting it to interact with a search function on a webpage.


If you have Accordance Bible Software, once you have the Bible reference in the SystemClipboard, you can use AppleScript to get the verse from the designated Bible version (given that you own it) in Accordance.

The advantage is that it works in any app and you don't need to switch to browser, wait for it to load, etc...