Raycast script for keyboard-launching Logos searches, guides, tools, etc.

Chris Pennington
Chris Pennington Member Posts: 2
edited November 21 in English Forum

I took a few moments after seeing Mark Ward’s most recent video (https://youtu.be/erI89ewEJuo) and created a grouping scripts for Raycast (raycast.com) that mimics the ideas for Alfred (best as I can tell—I don't have Alfred).

You can install them here: https://github.com/cpenned/logos-bible-software-raycast-scripts

Hope it's a help to some! 

Tagged:

Comments

  • Lew Worthington
    Lew Worthington Member Posts: 1,501 ✭✭✭

    Thanks for the info. As a Windows user, I'll drive into this when I've got some time, but the idea is attractive.

  • Vince Mitchell
    Vince Mitchell Member Posts: 27 ✭✭

    Great stuff! Thanks Chris!

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Great stuff! Thanks Chris!

    Vince, is there any chance of doing something similar in Windows? I'm familiar with Keyprinha and Microsoft Powertoys, but don't have the coding ability to make it work as nice as it does for Alfred.

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Great stuff! Thanks Chris!

    Vince, is there any chance of doing something similar in Windows? I'm familiar with Keyprinha and Microsoft Powertoys, but don't have the coding ability to make it work as nice as it does for Alfred.

    Managed to figure it out. for anyone who might be interested in a Windows alternative to Alfred or Raycast I got the same functionality from keypirinha.com.

    Follow their installation instructions on their website. Then drop the attached file below in C:\"where you put the install"\Keypirinha\portable\Profile\User

    apps.ini

    To use, launch the program with CTRL+Windows+k, type in the three or four letter abbreviation (niv, esv, etc.) hit tab and then the scripture abbreviation (gen1.1). Unlike Mark Ward's example you do need to use the period in between chapter and verse.

    Supported translations and their abbreviation

    • ESV
    • NIV
    • CSB
    • HCSB
    • NET
    • KJV
    • NKJV
    • NASB1 = NASB 1995
    • NASB2 = NASB 2020
    • LEB
    • LXX = LES2
    • NRSV
    • CJB
    • LSB
    • NA28
    • BHS

    I might expand this later to include searches but will have to fiddle around with it more.

  • Vincent van Altena
    Vincent van Altena Member Posts: 29

    Hi Morgan,

    Did you ever work out the syntax for searching?

    Thanks!

    regards, Vincent

  • Frank Hodges
    Frank Hodges Member Posts: 293 ✭✭

    Wow Morgan, idk how I missed this thread but I'm glad I stumbled upon it. This is a game changer. 

    I've been trying to find a way that I can open Logos to specific tools and translations using my streamdeck without the application being open and this solves it. Thank you so much!

    Do you happen to have any recommendations on how I can utilize it to open up a specific layout? I would love to suggest that for any future updates. 

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Hi Morgan,

    Did you ever work out the syntax for searching?

    Thanks!

    Yes, I managed to get a working script for bible searches, and could change it to manage other type of searches. That part ended up being not so hard. It's been about a year since I first managed all of this so give me some time to get to my work computer and I can find all the relevant scripts. I've given myself a reminder for Monday to send it this way.

    EDIT: I forgot that I had to switch tools. All of this is done using autohotkey now which has a much wider support base than keyprinha.

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Wow Morgan, idk how I missed this thread but I'm glad I stumbled upon it. This is a game changer. 

    I've been trying to find a way that I can open Logos to specific tools and translations using my streamdeck without the application being open and this solves it. Thank you so much!

    Do you happen to have any recommendations on how I can utilize it to open up a specific layout? I would love to suggest that for any future updates. 

    Unfortunately, loading layouts is something that seem to have gone buggy over the past few months. Most other commands work except the commands to load layouts. Other tools should still be pretty straightforward. What did you have in mind?

    I had done quite a bit of work to customize things to my preference using already existing scripts by another user, PJ. He's since moved over to Mac and doesn't do much with his previous scripts.

    • Open links in workflows to what was in the reference box (e.g. Put an L4 link to Carson and Beale's NT Use of the OT in your workflow. That link is fixed and unmoving. The script will automatically update it to whatever reference you have your workflow set to.) This one still works.
    • Layout shortcuts (Hotkeys that load your specific layouts, update them, or close the active layout. Sadly, this one is now defunct. For the past 8 or so months it keeps conflicting and cannot open layouts.)
    • I combined the previous two in a great way. I would hyperlink my scripts in my workflows to open up unique layouts to whatever passage my workflow was set to. For example, I had a bible reading layout with multiple versions, text comparison, etc. which could then be opened to whatever my workflow was set to. Think dynamic layouts that change based on whatever passage you have loaded, instead of manually building or changing your layouts.)

    But unfortunately until I can figure out what the new conflict is (something to do with windowsbase?) it doesn't work on my machine anymore. I'm more than happy to send everything your way though (maybe if it runs on yours I can figure out what's wrong with me!)

    I have no idea what a streamdeck is, or how it would work. Everything I've put together runs on autohotkey. So if you can run that, you should be able to get what you need.

  • Frank Hodges
    Frank Hodges Member Posts: 293 ✭✭

    I have no idea what a streamdeck is, or how it would work. Everything I've put together runs on autohotkey. So if you can run that, you should be able to get what you need.

    It's essentially a hardware macro device that has little LCD screens and allows you to open apps, run macros, etc... like an extension of the keyboard but with a screen. Similar to the touchbar they used to make on macs, but IMO a bit better.

    I'm more than happy to send everything your way though (maybe if it runs on yours I can figure out what's wrong with me!)

    This would be great, and I'd be willing to test out whatever you need me to if it helps at all. 

  • Morgan
    Morgan Member Posts: 457 ✭✭

    FULL DISCLOSURE: I'm not a programmer and these lines of code are literally my only experience in such. But I do get fixated on tiny inconveniences and dedicate unhealthy amounts of time in fixing them. I can't completely tell you what each line of code does - I've forgotten over the past year. That said, I've never run into any errors or crashes. The programs simply find logos and ask it to do something, or open an L4 link as specified in the code.

    Here are the simple scripts that should run no problem. All rely on autohotkey, which is free to install and run. Remap to your desired keys using this reference.

    I can't attach the files to the post itself, so I've included OneDrive links. Previews of the code will be in the following posts if you'd rather copy/paste. If you can get these working I'd be willing to put in the work to see about some of the (far more) complex code that's been written, but depends on the layout commands working.

    Open Bibles to Passage: Download from OneDrive

    • Current hotkey set to CTRL+.
    • Opens a dialogue box. Enter the (typically) three letter abbreviation of whatever translation, hit space, then enter your passage )can be abbreviated like anywhere else in Logos)
    • E.g. esv jhn 1.1 will open the ESV to John 1:1

    I had to replace some inconvenient strings which are noted in the code itself. Open it in notepad and you can edit as you see fit. E.g. the L4 link for the Lexham Greek New Testament Interlinear Bible is "lgntisbl" but I didn't want to type that in every time, so I gave it a nickname "gint" that the program will recognize as "lgntisbl." You can make your own nicknames by copy and pasting existing lines of code, putting your nickname in the first set of quotations, and the L4 resource link in the second set of quotes.Find the L4 resource ID with "Copy link as: L4" in the three dot menu to the top right in your bible.

    Bible Search: Download from OneDrive

    • Current hotkey is CTRL+'
    • Opens a dialogue box. Enter searches as you would normally. E.g. ("holy spirit" OR "spirit of god") IN bible:Matthew will be interpreted correctly.
    • Search results will open in top bibles.
    • If you want to change how search results are displayed, or other options, set up the search in Logos as you would ideally have it, copy it's L4 link and replace the link in the code.
    • Another hotkey CTRL+Shift+Numpad0 will launch a books search.

    Layout Commands: Download from OneDrive

    Can't get this one to work anymore, which cause issues with most other scripts. Close layout and save layout do still work though.

    • Hotkeys are CTRL+(1-7) but only on the numpad.
    • In the code, replace the layout names in quotation makrs with your own layout names
    • CTRL+- (on the numpad) will close the current layout
    • CTRL+(arrow key up) will save the current layout
  • Morgan
    Morgan Member Posts: 457 ✭✭

    Open Bible Passages

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

    Enabled := ComObjError(0)

    ^.::
    InputBox, Passage, Bible Reference
    StringSplit, Ref, Passage, %A_Space%

        Ref1 := StrReplace(Ref1, "niv" , "niv2011")

        Ref1 := StrReplace(Ref1, "lsb" , "lgcystndrdbblsb")

        Ref1 := StrReplace(Ref1, "net" , "netbible2ed")

        Ref1 := StrReplace(Ref1, "bfe" , "bibleforeveryone")

        Ref1 := StrReplace(Ref1, "bhs" , "bhssesb")

        Ref1 := StrReplace(Ref1, "na" , "na28")

        Ref1 := StrReplace(Ref1, "lxx" , "lelxx2")

        Ref1 := StrReplace(Ref1, "nasb20" , "nasb2020")

        Ref1 := StrReplace(Ref1, "hint" , "fhhebint")

        Ref1 := StrReplace(Ref1, "gint" , "lgntisbl")

        Ref1 := StrReplace(Ref1, "kjv" , "kjv1900")

    run, logosres:%Ref1%;ref=Bible.%Ref2%

    return

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Layout Commands

    #NoEnv

    ;Replace test with Layout name

    Enabled := ComObjError(0)

    ^Numpad0::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("0. Bible Reading")
    return

    ^Numpad1::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("Sermon A")
    return

    ^Numpad2::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("Sermon B")
    return

    ^Numpad3::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("Sermon C")
    return

    ^Numpad4::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("Proverbs")
    return

    ^Numpad5::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("Jeremiah")
    return

    ^Numpad7::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("7. Greek Translation")
    return

    ;==========================
    ;Update and Close Layouts
    ;===========================

    ;Close Layout
        ;Finds Logos Main Application Window and sends keyboard shrotcut for close all panels
    ^NumpadSub::
    SetTitleMatchMode, RegEx
    WinActivate, Logos Bible Software - *
    Send, ^+W
    return

    ; Update Active Layout
        ;Find the name of the active layout through the Main applicaiton title, splits off the layout name and updates it
    ^Up::
    Logos := ComObjActive("LogosBibleSoftware.Application")
    SetTitleMatchMode, RegEx
    WinActivate, Logos Bible Software -
    WinGetActiveTitle, Title
    layout_name := StrSplit(Title, "-")
    Logos.SaveLayout(layout_name[2])
    return

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Searches

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    #SingleInstance Force
    SetBatchLines, -1
    Enabled := ComObjError(0)

    ^'::
    InputBox, a
    b := StrReplace(a, """" , "$22")
    Run, logos4:Search;kind=BibleSearch;q=%b%;syntax=v2;documentlevel=verse;match=stem;in=raw:Top$7CDataType$3Dbible$7CResourceType$3Dtext.monograph.bible$7CResultLimit$3D5$7CTitle$3DTop$2520Bibles;viewkind=passages
    return

    ^!Numpad0::
    InputBox, c
    d := StrReplace(c, """" , "$22")
    Run, logos4:Search;kind=BooksSearch;q=%d%;syntax=v2;exactref=true;match=nostem;in=raw:Collection$7CCollectionName$3DCollectionId$253da42a97ca-2b33-4d0d-bccf-972289d65792$257cTitle$253dModern$252520Commentaries;groupkind=book;groupsortkind=resultsCount;expandedlibrarylocations=local
    return

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    I've been trying to find a way that I can open Logos to specific tools and translations using my streamdeck without the application being open and this solves it. Thank you so much!

    I also use StreamDeck and would like to ask you how you have assigned the buttons. Can you give me an example? Do you do it with "Text" or how?

    Thank you very much
    Andreas

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Morgan
    Morgan Member Posts: 457 ✭✭

    If you can make your streamdeck run a specific script the Autohotkey code would be very simple.

    Just find the L4 link (found in the three dot menu, top right corner of the tool/book) and your code just looks like this:

    Run, logos4:TextComparison

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    Just find the L4 link (found in the three dot menu, top right corner of the tool/book) and your code just looks like this:

    Run, logos4:TextComparison

    Thank you very much.
    Is there a way that I can open a specific work environment with my Streamdeck? That would be great. Unfortunately I can't create an L4 link for a workspace.

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    For Lut84, which is popular in Germany, I have added the following lines to apps.ini:

    [cmd/lut84]
    label = lut84
    cmd = logosres:lutbib1984;ref=BibleLUTBIB1984.{{*}}

    Works very well for me. Call with lut84 tab key & Bible passage

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Morgan
    Morgan Member Posts: 457 ✭✭

    There is the LoadLayout command that you can see examples of in my script above. I'd recommend going through the Logos COM API article to get a sense of what can be accomplished.

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    There is the LoadLayout command that you can see examples of in my script above. I'd recommend going through the Logos COM API article to get a sense of what can be accomplished.

    Thank you very much. My knowledge is nowhere near enough for that. I thought it would be easier to do, but it doesn't have to be. 

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Try this, download Autohotkey here.

    1. Right click your desktop and select New - Autohotkey Script
    2. Select Empty and then a new AHK file will appear on the desktop.
    3. Right click on the new file, and open with notepad
    4. Paste the following into the notepad

    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("")
    return

    Type the name of the layout you want to open in between the quotation marks.

    From there, you can double-click the file to run the script, or, I imagine, can someone how your streamdeck to open it.

  • Frank Hodges
    Frank Hodges Member Posts: 293 ✭✭

    I've been trying to find a way that I can open Logos to specific tools and translations using my streamdeck without the application being open and this solves it. Thank you so much!

    I also use StreamDeck and would like to ask you how you have assigned the buttons. Can you give me an example? Do you do it with "Text" or how?

    Thank you very much
    Andreas

    Are you asking if i could share my layout? If so yes I would be happy to  


  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    Thank you both for the effort you have made. God's blessing.
    I'm going to try Autohotkey this afternoon and the Streamdeck layout looks good. Gives me a good idea of how I want to set mine up for logos.
    I use StreamDeck for logos mainly in library tagging, for recording and labeling PersonalBooks etc. and now I have many more options. Brilliant.

    Many thanks again
    Andreas

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("")
    return

    Thank you for the Code. 

    Unfortunately, it doesn't work for me, which may also be because I'm using a German version.

    I will experiment and maybe I will find the solution.

    The combination with StreamDeck would definitely work. I'm really looking forward to it.

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • xnman
    xnman Member Posts: 2,779 ✭✭✭

    I apologize for not understanding this thread more fully.  But I find it easy, to start Logos, build a layout, name the layout and then set the "Program Settings" to always start that layout when I start Logos, which since I have Logo Icon on my "Task Bar" (windows) then I just click and up pops Logos to the layout I set it to.

    I know there's more to building "Scripts" to do things... but what I said above seems very easy for Logos.

    xn = Christan  man=man -- Acts 11:26 "....and the disciples were first called Christians in Antioch".

    Barney Fife is my hero! He only uses an abacus with 14 rows!

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    I know there's more to building "Scripts" to do things... but what I said above seems very easy for Logos.

    I agree with you and of course this is the right way to go.
    However, I have some special layouts that I would like to start externally - depending on the work situation - if, for example, I am carrying out internet research on a topic in order to work with a specific layout at short notice.
    At the moment, I work with the favorites and thus have a shorter detour.

    If I manage to start work environments from my StreamDeck, for example, I would have Word & PDF files, web research and logos components thematically on different desks and I find that very convenient, especially when I'm switching between them a lot.
    It would make my work much easier.

    But basically I agree with you.

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]

  • Morgan
    Morgan Member Posts: 457 ✭✭

    Logos := ComObjActive("LogosBibleSoftware.Application")
    Logos.LoadLayout("")
    return

    Thank you for the Code. 

    Unfortunately, it doesn't work for me, which may also be because I'm using a German version.

    I will experiment and maybe I will find the solution.

    The combination with StreamDeck would definitely work. I'm really looking forward to it.

    Could you show me a full screenshot of that error code you're getting? Like I said, everything I've tested with the COM API is working EXCEPT loading layouts. I'm curious if your machine is throwing the same warnings and source.

  • Andreas Roemer
    Andreas Roemer Member Posts: 1,130 ✭✭

    Could you show me a full screenshot of that error code you're getting? Like I said, everything I've tested with the COM API is working EXCEPT loading layouts. I'm curious if your machine is throwing the same warnings and source.

    Gerne.

    Ausgeführt mit 1.1.37.01 Unicode 64-bit HotKeyLauncher:

    Ausgeführt mit 2.0.11 64-bit AutoHotKeyLauncher:

    The script then no longer provides any feedback and must be stopped.

    ---
    Das Gerücht ist nicht immer falsch; manchmal wählt es sogar den Sieger aus.[Tacitus]