Help with workflows

Mike Hogue
Mike Hogue Member Posts: 76 ✭✭
edited November 2024 in English Forum

I'm interested in making a workflow that can open specific resources using the reference put into the input box when starting the workflow.  For example, I'd love to be able to have one of the steps be to check Carson and Beale's Commentary on the NT use of the OT.  I can put in a link to that book (by copying the location using the three-dot menu for the reference, and then using that as a link) but it will be tagged to whatever location I had in the shortcut rather than the target for the workflow.

I can also copy searches.  For example:

https://ref.ly/logos4/Search?kind=BasicSearch&q=John+3:16&match=nostem&in=raw:Collection|CollectionName=Tag%3dSermons%7cTitle%3dSermons

searches references I've tagged with "Sermons" for John 3:16.  It's just always John 3:16.  If I could grab the content of the workflow input box and somehow use that in my own searches, it would be extremely helpful. It would then be easier to specifically get what I'm after.

Is there an easy way to do this?

Thanks in advance,

Mike

Comments

  • MJ. Smith
    MJ. Smith MVP Posts: 55,539

    bump 6

    Orthodox Bishop Alfeyev: "To be a theologian means to have experience of a personal encounter with God through prayer and worship."; Orthodox proverb: "We know where the Church is, we do not know where it is not."

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    Thanks MJ - by "bump 6" are you helping the post stay current?  I guess I'm not familiar with that terminology!

  • MJ. Smith
    MJ. Smith MVP Posts: 55,539

    Yes, bumping keeps the post current. The 6 is simply to make it past the spam detector.

    Orthodox Bishop Alfeyev: "To be a theologian means to have experience of a personal encounter with God through prayer and worship."; Orthodox proverb: "We know where the Church is, we do not know where it is not."

  • MJ. Smith
    MJ. Smith MVP Posts: 55,539

    Since no one has provided an answer and I haven't tried to solve the problem, have you played with opening to an inline search or using a multiview window?

    Orthodox Bishop Alfeyev: "To be a theologian means to have experience of a personal encounter with God through prayer and worship."; Orthodox proverb: "We know where the Church is, we do not know where it is not."

  • Lonnie Spencer
    Lonnie Spencer Member Posts: 371 ✭✭

    The only way I can think of to get the Commentary on the New Testament Use of the Old Testament into the work flow so it will move with the workflow text is to prioritize the Commentary on the New Testament use of the Old Testament  with your other prioritized commentaries in your library so it would show up in the commentary step of your workflow. I'm hoping there is a better way that someone else comes along with.

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    MJ - to your questions I haven't -- although a super-quick test does seem to show multi-view may work for a versified reference. 

    I have two thoughts with this approach, though:

    1. I'd like it to be more generic....i.e. the NT use of the Old commentary isn't necessarily the only book I'd like to be able to do this with.  I have other non-versified references as well that I'd love to be able to open with a search for the specific verse using the workflow. As above, I can specify the verse outright (as in the search in my first post) but this is rather inflexible.

    2. The multi-view approach does have some promise for versified references -- although I'd be a little more intensive if I had several books I were trying to do this with. I'd probably have to manually uncheck/recheck references to have enough screen real estate to make this useful.  If I wanted to try this approach in my normal workflow with five different references, for example, I'd have the Bible +5 or a 6-way split, unless most of these resources were somehow set up yet unchecked.  Normally I use multi-view for other languages -- e.g. BHS, NA, UBS, and the LXX.  

    I appreciate the thoughts!  Keep them coming!  I'd *love* for the workflow process to be able to be a more-robust checklist for me on Bible-study or sermon prep...it just doesn't quite feel there yet.

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Mike,

    I know most users fear the ComAPI. However, this is the easiest solution for a generic approach. With a little creativity, a lot can be accomplished. Here's an example of how I approached the issue in AutoHotkey. It can be easily translated into any other language.

    1) Get the running Logos Instance

    2) Attach EventHandling for the Application

    3) Handle the Panel Opened Event

    4) Loop all Open Panels and find the Workflow (only one should be open)

    5) Strip the Reference

    6) Create a Navigation Request

    7) Parse the reference as a LogosDataTypeReference

    8) Set the Navigation Request's Reference to the one you Parsed in step 7

    9) Navigate the Opened Panel

    10) break out of the loop to exit the EventHandler

    CODE

    #SingleInstance Force
    #Persistent

    ;Get the running Logos Instance
    app := ComObjActive("LogosBibleSoftware.Application")

    ;Attach EventHandling for the Application
    ComObjConnect(app,"app_")

    return

    ;Handle the Panel Opened Event
    app_PanelOpened(Panel){
    global app

    for p in app.GetOpenPanels
    {
    if (p.Kind = "Workflow")
    {
    title := p.Title
    s := StrSplit(title,"|")
    ref := s[2]
    nr := app.CreateNavigationRequest
    ref := app.DataTypes.GetDataType("Bible").ParseReference(ref)
    nr.Reference := ref
    Panel.navigate(nr)

    break
    }
    }
    }

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ - this is helpful!  I wish the functionality were a little more straightforward, but I can work with this some.  

    I was able to find the documentation for the Logos COM API (which I didn't know was available) at https://wiki.logos.com/Logos_4_COM_API.

    That said (and I haven't researched this much), off the top of your head do you know how to insert a script call, such as the one you've written here, as something to be run as a step in the workflow?  Adding a step in the workflow seems to be pretty limited to text or pre-defined sections of already existing guides. Is there an easy way to link running the script to a shortcut?

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    off the top of your head do you know how to insert a script call, such as the one you've written here, as something to be run as a step in the workflow?

    I think it would be somehow possible to insert a hyperlink into a Text Field to execute a script from the Workflow. I'll take a look.

    Through many tests with the ComAPI I have found that a Script that monitors in the background is much better than a link from a Workflow.

    I'm interested in what you're trying to do and how it fits into the workflow process. Maybe I already have a script that does exactly that. Which OS do you use Win or Mac.



  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    PJ said:

    I think it would be somehow possible to insert a hyperlink into a Text Field to execute a script from the Workflow.

    Use the file protocol in your link. For a vbs script it would look like this:

    file:///D:/Script.vbs

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Following is a sample on how to go about to impliment this for any Uri in Logos using the logos4 protocol. The sam elogic can be used for any kind of uri.

    Hope this helps:

    /*
    This is to create a Search Link from a Workflow to do a specific Search with the Workflow's Reference
    Just Replace the UriTemaplate's value with your logos4 uri
    Then Copy the Reference part exactly to the WhatToReplaceWithTheReference variable
    Add a File protocol link in your Workflow
    file:///C:/ThisScriptsTitle.ahk
    */
    #SingleInstance

    app := ComObjActive("LogosBibleSoftware.Application")
    UriTemplate := "logos4:Search;kind=BibleSearch;q=Jesus;match=stem;exactref=true;in=raw:Single$7CResourceId$3DLLS:1.0.630;references=bible$2Bafr1983.64.3"
    WhatToReplaceWithTheReference := "bible$2Bafr1983.64.3" ;The Reference part in the above uri

    title := Panel.Title
    s := StrSplit(title,"|")
    ref := s[2]

    ref := app.DataTypes.GetDataType("Bible").ParseReference(ref)
    newRef := ref.Render("long")
    StringReplace,newRef,newRef,title,1
    newRef := SaveRefAsKey(newRef)
    StringReplace, uri, UriTemplate, WhatToReplaceWithTheReference, %newRef%
    StringReplace,uri, uri,%A_Space%,$2B
    app.executeuri(uri)


    SaveRefAsKey(ref){
    global app
    LDTR := app.DataTypes.GetDataType("Bible").ParseReference(ref)

    rangeStart := LDTR.RangeStart.Render("long")
    rangeEnd := LDTR.RangeEnd.Render("long")

    StringReplace, rangeStart, rangeStart,:,.,All
    StringReplace, rangeStart, rangeStart,Genesis,bible.1,All
    StringReplace, rangeStart, rangeStart,Exodus,bible.2,All
    StringReplace, rangeStart, rangeStart,Leviticus,bible.3,All
    StringReplace, rangeStart, rangeStart,Numbers,bible.4,All
    StringReplace, rangeStart, rangeStart,Deuteronomy,bible.5,All
    StringReplace, rangeStart, rangeStart,Joshua,bible.6,All
    StringReplace, rangeStart, rangeStart,Judges,bible.7,All
    StringReplace, rangeStart, rangeStart,Ruth,bible.8,All
    StringReplace, rangeStart, rangeStart,1 Samuel,bible.9,All
    StringReplace, rangeStart, rangeStart,2 Samuel,bible.10,All
    StringReplace, rangeStart, rangeStart,1 Kings,bible.11,All
    StringReplace, rangeStart, rangeStart,2 Kings,bible.12,All
    StringReplace, rangeStart, rangeStart,1 Chronicles,bible.13,All
    StringReplace, rangeStart, rangeStart,2 Chronicles,bible.14,All
    StringReplace, rangeStart, rangeStart,Ezra,bible.15,All
    StringReplace, rangeStart, rangeStart,Nehemiah,bible.16,All
    StringReplace, rangeStart, rangeStart,Esther,bible.17,All
    StringReplace, rangeStart, rangeStart,Job,bible.18,All
    StringReplace, rangeStart, rangeStart,Psalm,bible.19,All
    StringReplace, rangeStart, rangeStart,Proverbs,bible.20,All
    StringReplace, rangeStart, rangeStart,Ecclesiastes,bible.21,All
    StringReplace, rangeStart, rangeStart,Song of Solomon,bible.22,All
    StringReplace, rangeStart, rangeStart,Isaiah,bible.23,All
    StringReplace, rangeStart, rangeStart,Jeremiah,bible.24,All
    StringReplace, rangeStart, rangeStart,Lamentations,bible.25,All
    StringReplace, rangeStart, rangeStart,Ezekiel,bible.26,All
    StringReplace, rangeStart, rangeStart,Daniel,bible.27,All
    StringReplace, rangeStart, rangeStart,Hosea,bible.28,All
    StringReplace, rangeStart, rangeStart,Joel,bible.29,All
    StringReplace, rangeStart, rangeStart,Amos,bible.30,All
    StringReplace, rangeStart, rangeStart,Obadiah,bible.31,All
    StringReplace, rangeStart, rangeStart,Jonah,bible.32,All
    StringReplace, rangeStart, rangeStart,Micah,bible.33,All
    StringReplace, rangeStart, rangeStart,Nahum,bible.34,All
    StringReplace, rangeStart, rangeStart,Habakkuk,bible.35,All
    StringReplace, rangeStart, rangeStart,Zephaniah,bible.36,All
    StringReplace, rangeStart, rangeStart,Haggai,bible.37,All
    StringReplace, rangeStart, rangeStart,Zechariah,bible.38,All
    StringReplace, rangeStart, rangeStart,Malachi,bible.39,All
    StringReplace, rangeStart, rangeStart,Tobit,bible.40,All
    StringReplace, rangeStart, rangeStart,Judith,bible.41,All
    StringReplace, rangeStart, rangeStart,Additions to Esther,bible.42,All
    StringReplace, rangeStart, rangeStart,Wisdom of Solomon,bible.43,All
    StringReplace, rangeStart, rangeStart,Sirach,bible.44,All
    StringReplace, rangeStart, rangeStart,Baruch,bible.45,All
    StringReplace, rangeStart, rangeStart,Letter of Jeremiah,bible.46,All
    StringReplace, rangeStart, rangeStart,Song of Three Youths,bible.47,All
    StringReplace, rangeStart, rangeStart,Susanna,bible.48,All
    StringReplace, rangeStart, rangeStart,Bel and the Dragon,bible.49,All
    StringReplace, rangeStart, rangeStart,1 Maccabees,bible.50,All
    StringReplace, rangeStart, rangeStart,2 Maccabees,bible.51,All
    StringReplace, rangeStart, rangeStart,1 Esdras,bible.52,All
    StringReplace, rangeStart, rangeStart,Prayer of Manasseh,bible.53,All
    StringReplace, rangeStart, rangeStart,Additional Psalm,bible.54,All
    StringReplace, rangeStart, rangeStart,3 Maccabees,bible.55,All
    StringReplace, rangeStart, rangeStart,2 Esdras,bible.56,All
    StringReplace, rangeStart, rangeStart,4 Maccabees,bible.57,All
    StringReplace, rangeStart, rangeStart,Ode,bible.58,All
    StringReplace, rangeStart, rangeStart,Psalms of Solomon,bible.59,All
    StringReplace, rangeStart, rangeStart,Epistle to the Laodiceans,bible.60,All
    StringReplace, rangeStart, rangeStart,Matthew,bible.61,All
    StringReplace, rangeStart, rangeStart,Mark,bible.62,All
    StringReplace, rangeStart, rangeStart,Luke,bible.63,All
    StringReplace, rangeStart, rangeStart,John,bible.64,All
    StringReplace, rangeStart, rangeStart,Acts,bible.65,All
    StringReplace, rangeStart, rangeStart,Romans,bible.66,All
    StringReplace, rangeStart, rangeStart,1 Corinthians,bible.67,All
    StringReplace, rangeStart, rangeStart,2 Corinthians,bible.68,All
    StringReplace, rangeStart, rangeStart,Galatians,bible.69,All
    StringReplace, rangeStart, rangeStart,Ephesians,bible.70,All
    StringReplace, rangeStart, rangeStart,Philippians,bible.71,All
    StringReplace, rangeStart, rangeStart,Colossians,bible.72,All
    StringReplace, rangeStart, rangeStart,1 Thessalonians,bible.73,All
    StringReplace, rangeStart, rangeStart,2 Thessalonians,bible.74,All
    StringReplace, rangeStart, rangeStart,1 Timothy,bible.75,All
    StringReplace, rangeStart, rangeStart,2 Timothy,bible.76,All
    StringReplace, rangeStart, rangeStart,Titus,bible.77,All
    StringReplace, rangeStart, rangeStart,Philemon,bible.78,All
    StringReplace, rangeStart, rangeStart,Hebrews,bible.79,All
    StringReplace, rangeStart, rangeStart,James,bible.80,All
    StringReplace, rangeStart, rangeStart,1 Peter,bible.81,All
    StringReplace, rangeStart, rangeStart,2 Peter,bible.82,All
    StringReplace, rangeStart, rangeStart,1 John,bible.83,All
    StringReplace, rangeStart, rangeStart,2 John,bible.84,All
    StringReplace, rangeStart, rangeStart,3 John,bible.85,All
    StringReplace, rangeStart, rangeStart,Jude,bible.86,All
    StringReplace, rangeStart, rangeStart,Revelation,bible.87,All
    StringReplace, rangeStart, rangeStart,Enoch,bible
  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    I'm on a Surface Book 2 running Windows 10.

    I'd like steps in my workflow to search for the specified Scripture in specified references...especially when the reference isn't versified.

    I'd ideally like to be able to add references.  For example, I'd like to add a workflow step to search a sermon archive (Keller? Piper?) for references to the passage listed when I start the workflow.  In another step, I'd like to search an illustration encyclopedia.  In another, perhaps a Bible dictionary...or BDAG.  The point is that if there are specific references that I'd like to regularly check, I'd like to be able to specify them as specific steps in a workflow and then be able to pinpoint the place(s) in that reference without taking extra steps.

    Thanks for engaging on this!

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    4846.URITool.zipHere is a Working Prototype

    Search the internet and download AutoHotkey Engine and install it.

    Download the attachment below.

    Extract it

    There are 2 files

    • Go.ahk
    • HyperLink.ahk

    Go.ahk is used inside Hyperlink.ahk files to run the link you specify

    The Following steps need to be followed for each Resource or Search link you use inside Workflows.

    I included both the logos4 and logosres Protocols.

    Make a Copy of the Hyperlink.ahk File and Rename it with a relevant name without spaces

    Sample: Search.ahk

    Open the File (Search.ahk)

    It contains two lines of code

    1. uri := ""
    2. #Include D:\URITool\Go.ahk

    Change #Include D:\URITool\Go.ahk to point to the location of the Go.ahk file on your disk.

    Inside Logos, do your search and set the Search Panels "Copy Location As setting" to L4

    Press Ctrl+Alt+C to copy the location of the Search Panel to the Clipboard

    In Line 1 on the Search.ahk, paste the location

    Example

    uri := "logos4:Search;kind=BasicSearch;q=$3CGen_1:1$3E;match=stem;exactref=true;in=raw:LibraryCatalog$7CQuery$3DAuthor:Carson$7CResourceKind$3DNone$7CSupportedResourceIds$3D$7CSupportedTypes$3D$7CTitle$3D19$2520resources$2520with$2520Author:Carson"

    Save the File and close it.

    Create a Link inside your Workflow that points to this script you created.

    You need a script with two lines of code for each generic Search you want to use as link.

    When the link is clicked from the Workflow, the Include line imports the code to handle the supplied url from Search.ahk.

    It finds a small piece inside the uri. In the Example it is: q=$3CGen_1:1$3E

    Then the script gets the Workflows Reference and Parses it to either a Reference to use in a Search or a Resource and replaces the above piece with the new Reference.

    When done it executes the uri in Logos.

    I'll try to improve on this idea and make it a lot easier and faster to accomplish. This is just a starting point.

    I hope this helps.

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ - thank you!!!

    I'll work to get it installed and working, but I appreciate you putting your programming/COM API skills to work to provide functionality in places it was missing!

    I'll be standing by for whatever improvements you make! Will you be posting them here on this thread?

    ...makes me wonder what other functionality you've added via programming.

    Thanks again!

    Mike

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    ...makes me wonder what other functionality you've added via programming.

    I did play a lot with the ComAPI and some other API's. Automated Mindmapping, Word reacting as if it were a Resource. Personal Book Builder Automation. All this was preparing me for the following script that is supposed to collect all the above and other ideas into one single system.

    The script I'm currently working on has the same functionality as you described but on a completely different level.

    The script handles Workflows, Layouts and Resources at this stage.

    I create a Workflow for each Step that needs to create a document. I want all my documents to be automatically named by Logos. The reason for this is to enable a Workflow to know exactly what documents belong to a certain project I'm working on. I think of Workflows in a Parent-Child relationship. When exporting a Workflow it can then suggest other documents I may want to import into Word. This will become clear as you read further.

    When I export a Workflow (Parent) it's supposed to be able to generate the structure of a complete book inside Word. I then just import other Workflow data (children) at specific locations in Word.

    A Workflow in my mind is nothing more than a single task with a specific structure relating to a final draft for a book. Each Workflow is just a small part of a bigger picture.

    Each workflow gets its own corresponding Layout with the same name. One Workflow, One Layout. This way Workflow and Layout know about each other and I can focus on just one task at a time. When a Workflow has a DataType filled in as Reference it creates a new layout for that specific started workflow.

    The power of this start to get visible when I link Workflows to other Workflows containing a single step. Workflows become a huge network. My Documents become an integrated system enabling me to create almost any kind of resource from small pieces of data collected over time. I never do anything twice in two different Workflows. In my mind, if you do something once in a single-minded workflow, it's done.

    When I click on a link inside a workflow (Parent) to open another workflow (child step) the corresponding Workflow's Layout opens. The Reference of the Parent is passed to the new Layouts Workflow (child).

    I use LinkSet F to link resources between Layouts. This way Layouts are intelligently communicating with each other.

    My system tracks the history of Workflows to enable me to go forward or backward in my process.

    The code is a bit complicated as I wrote a procedure to edit the script automatically. The script is actually recognizing different combinations of Layouts and Workflows and Resources. Some Procedures, therefore, have a Binary name consisting of 0's and 1's. This is kind of a very fast Binary Decision tree triggered by whatever is happening on my screen. Each 0 and 1 has a specific meaning relating to information I obtain from Logos in a specific order. I'm working towards a neural network that can suggest how to use Logos or that can learn how I use Logos and then start to do it automatically. This dream is rather far away because I'm the only one working on this and I'm learning on the go.

    The fun starts when I open something that the code doesn't recognize. It wil popup a window with already existing functions from the code. I select whatever I want it to do and the code is added automatically to the script. The script then restarts itself and then know how to handle that specific situation.

    I did not provide you with this version because even I'm not always understanding what It's doing.

    I love to think hard and solve problems. I scan the forum from time to time to see if there is some idea or problem I can try to solve to increase my knowledge about Logos. Your problem triggered some new ideas to speed up my Workflow.

    I appreciate you sharing what you dream Logos should look like.

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    Wow PJ - I'd love to see a video demonstration of what you're doing as it sounds like you're taking some functionality to a new level.

    I'm about to go on a vacation, but when I return perhaps I'll post two other projects that I suspect can only be solved programmatically at this point...one involving opening a non-dated resource (like Boa's Handbook to Prayer) to a date-specific location each day, and the other involving parsing the apparatus of the NA28 for a verse and dividing the witnesses by family and sorting by date. I'd love to know your thoughts on the possibilities of these based on COM-API, but as I mentioned they probably go in a different location.

    If you ever do a screencast demonstrating what you've done with your script, please post a link.  Thanks!

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    parsing the apparatus of the NA28 for a verse and dividing the witnesses by family and sorting by date

    I do not have this resource, but it sounds like a job for python and maybe the comapi. Python is extremely good at parsing text. I once build a summarizer that highlighted paragraphs. It almost did it exactly as I would have done it. The code must be somewhere in my archives.

    opening a non-dated resource (like Boa's Handbook to Prayer) to a date-specific location each day

    This sounds interesting ... maybe a Reading Plan can solve this? Did you try any solutions?

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ,

    Python is good at parsing text - for a while I was in a program to learn Kyrgyz and wrote a script that would parse a news article and build a histogram of important words.  Was about 5 lines of code.

    I noticed you had a thread on teaching people to connect to the API using VB - would love to see one on Python as well, as I'm much more familiar with it and its capabilities than VBA.

    Thank you for the video! I didn't hear any sound but what I saw looked great.

    I'll start another thread for the Boa Handbook -- so we can interact there.  A Reading Plan probably won't work the way I'd like, though, as the resource has some "extra" entries (divided into 12 "sections" of 31 divisions each.  Close to 12 months, but no real starting point. I'd probably just end up ignoring the extra entries for sections with fewer than 31 days.)

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ,

    Is there a way in the workflow to open a Canvas document and then import the passage of Scripture?  This would be used to create one's own structural outline.

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Is there a way in the workflow to open a Canvas document and then import the passage of Scripture?

    I did not do or test this but could see myself investigating several options.

    1. .Net WPF UIAutomation (this is difficult but fast.)
    2. Any other language capable of UI Automation in any way (Image Search or Keyboard Shortcuts. This is very tricky and unreliable)
    3. ComAPI CopyBibleVerses and Paste (Ctrl+V)

    The third option would be my best bet. Wait for a PanelOpened Event and Paste some GraphModel code with Ctrl+V. To begin to grasp this you can create a new canvas and add a shape. Select the shape and copy it to the clipboard. Paste it in Notepad and you'll see the GraphModel. You can use a site like https://www.url-encode-decode.com/ to decode this text string to a human-readable format. If you create this GraphModel and encode it you can paste it directly into Canvas.

    Copy the below string and observe the outcome when pasted into Canvas:

    %3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%26lt%3Bh1%26gt%3BBRILLIANT!%26lt%3B%2Fh1%26gt%3B%26lt%3Bp%26gt%3BYou%20can%20now%20start%20to%20generate%20anything%26lt%3B%2Fp%26gt%3B%22%20style%3D%22text%3Bhtml%3D1%3BstrokeColor%3Dnone%3BfillColor%3Dnone%3Bspacing%3D5%3BspacingTop%3D-20%3BwhiteSpace%3Dwrap%3Boverflow%3Dhidden%3Brounded%3D0%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22660%22%20y%3D%22200%22%20width%3D%22320%22%20height%3D%22180%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E

    I hope this gives you an idea how to solve this.

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ,

    All of a sudden this script (and all others) seem to be broken - am getting this message:

    Screenshot 2021-03-10 104640

    Did Logos change something?  Where would this com object be located/registered in order to be used?

    Thanks in advance!

    Mike

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    Never mind...somehow the COM API had disappeared.  Running logos.exe /register fixed the problem.

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Glad to see it's fixed ...

    For future, the ComAPI is located at default location C:\Users\%UserName%\AppData\Local\Logos\System\LogosCom.exe

    I'm so glad to see you are still using the script.

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ,

    The script still works GREAT, with one caveat...it seems that if I would like to open a reference that is part of a series (like a commentary, for example) from the workflow, only the original volume will open.  In other words, let's say that I'd like to open the Word Biblical Commentary to Genesis 1:1 -- but the first time when I copied the location to build the appropriate AutoHotKey script I used the John volume.

    logosres:wbc36;ref=Bible.Jn5.19-30

    If the WBC volume 36 is already open to John and I type "Gen 1:1" in the reference window of the tab, it will move to the appropriate reference, since they're identified in the same series.  However, if I try to accomplish the same thing via the workflow and utilizing the script, it will open wbc36 to the last location it had open.

    Is there a way to make the script responsive to differences in series?  I see several uses for this...for example I have my Greek and Hebrew Bibles tied together in a user-defined series, and it would be efficient to have a single link between the two.

    Thank you in advance!

    Mike

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Mike,

    The code will need to be modified. How I do not know yet.

    Maybe two different ideas:

    1) Use a Link to a Search in a Collection? This will require more clicks than just one.

    2) You can maybe extract the ResourceId from the Library with the ComApi and replace it in the link?

    Sample

    You'll need the Book Name as String (ComApi — LogosBibleReferenceDetails.Book)

    App := ComObjActive("LogosBibleSoftware.Application")
    Book := "Genesis"

    Query := "Type:""Bible Commentary"" AND Series:""Tyndale Commentaries"" AND Title:<""" . Book . """>"
    LogosResourceInfoCollection := App.Library.GetResourcesMatchingQuery(Query)
    ResourceId := LogosResourceInfoCollection.Item[0].ResourceId

    MsgBox % ResourceId

    ToDo

    You can replace the "wbc36" in the link with the ResourceId

    logosres:wbc36;ref=Bible.Jn5.19-30

    logosres:%ResourceId%;ref=Bible.Jn5.19-30

    I hope this can point you towards a solution?

  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    PJ,

    Thanks for engaging on this again.  The trouble I see with this approach is that the title varies from series to series.  For example, if I were using the Word Biblical Commentary as I do in my last example, the title for volume 51 is "1, 2, 3 John".  In NIVAC, the title is "the Epistles of John."  

    I suppose some of my request comes from my lack of familiarity with both the ComAPI as well as AutoHotKey.  Would it be possible once the original script is run to locate the reference box for the newly opened window and send keys to put the reference in the reference box of the newly opened tab? At that point I would think the functionality already inherent in Logos would use the series information to move to the right volume automatically...I just don't know if something like that is easily accomplished.

    Again, thanks for indulging my questions.

    Mike

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Would it be possible once the original script is run to locate the reference box for the newly opened window and send keys to put the reference in the reference box of the newly opened tab?

    This is possible although it's not possible to reference the TextBox directly. I found sending keys a little tricky in some instances. I'll take a look and send you some code to do this.

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    Would it be possible once the original script is run to locate the reference box for the newly opened window and send keys to put the reference in the reference box of the newly opened tab?

    I reconsidered what you are trying to accomplish. I ended up with a short but much more generic approach using send keys as you mentioned. With this script you don't need the previous script. You can just open any link from anywhere in a Workflow. It will only send the Reference to a newly opened resource if opened from the workflow.

    Line 18 KeepRunning := True will keep the script running in the background

    If you want the script to terminate when the workflow close, change it to KeepRunning := False

    1. Run the Script (If KeepRunning == True you only need to start it once)
    2. Open a Started Workflow or a new Workflow and enter a Reference (steps 1 and 2 can be in any order)
    3. Open any resource, from a link in a Workflow, that you would like to receive the Reference of the Workflow
    4. The Resource should then navigate (receive sendkeys) to the Reference
    5. When the Workflow is closed the script will terminate if KeepRunning == True

    This script will only work correctly if one Workflow is open. The script can be terminated from the TrayIcon on the Windows Toolbar.

    Test this script and let me know if this solves the series issue and your initial request.

    Script : 6761.AddRefToOpenedPanel.zip

     
    #SingleInstance Force
    #Persistent
    #NoEnv

    KeepRunning := True
    Reference :=
    App := ComObjActive("LogosBibleSoftware.Application")
    ComObjConnect(App,"App_")

    for p in app.GetOpenPanels
    {
    if (p.Kind = "Workflow")
    {
    title := p.Title
    s := StrSplit(title,"|")
    ref := s[2]
    ref := app.DataTypes.GetDataType("Bible").ParseReference(ref)
    Reference := ref.Render("Short")
    }
    }

    return

    App_PanelActivated(Panel)
    {
    Global Reference
    Global App
    If (Panel.Kind == "Workflow")
    {
    title := Panel.Title
    s := StrSplit(title,"|")
    ref := s[2]
    ref := App.DataTypes.GetDataType("Bible").ParseReference(ref)
    Reference := ref.Render("Short")
    }
    }
    App_PanelClosed(Panel){
    Global Reference
    If (Panel.Kind == "Workflow")
    Reference :=

    If ((Panel.Kind == "Workflow") AND (KeepRunning == False))
    ExitApp
    }

    App_PanelOpened(Panel){
    Global App
    Global Reference

    if StrLen(Reference) > 0 AND !(Panel.Kind == "Workflow") {
    SetTimer,AddReference,100
    }
    }

    AddReference:
    SetTimer, AddReference, Off
    App.Activate

    Sleep, 100
    Send ^g

    Send, %Reference%
    Sleep,250
    Send, {ENTER}
    Reference := ""
    return



  • Mike Hogue
    Mike Hogue Member Posts: 76 ✭✭

    Thanks PJ - this works well!

    I appreciate that you worked on this again!

  • Pieter J.
    Pieter J. Member Posts: 533 ✭✭

    I'm on a Surface Book 2 running Windows 10.

    I'd like steps in my workflow to search for the specified Scripture in specified references...especially when the reference isn't versified.

    I'd ideally like to be able to add references.  For example, I'd like to add a workflow step to search a sermon archive (Keller? Piper?) for references to the passage listed when I start the workflow.  In another step, I'd like to search an illustration encyclopedia.  In another, perhaps a Bible dictionary...or BDAG.  The point is that if there are specific references that I'd like to regularly check, I'd like to be able to specify them as specific steps in a workflow and then be able to pinpoint the place(s) in that reference without taking extra steps.

    Thanks for engaging on this!

    I did something awesome a while back that changed the way I think about automating what you would like to do with steps. Each step I want to automate contained the name of a layout I would like to open for that step. I created a button that find the current step and then switch to that layout and then pass the reference of the workflow to panels with linkset F. (To find the reference in sql is much more stable that using ahk methods) This worked flawless but some other limitations in the way workflows work stoped me from investigating further.

    Another reason I don't really mention these ideas is because I make use of sql to find information. This kind of code in the wrong hands could corrupt db's.

    Just thought to share the edge of my dreams and projects that keeps me tiking when I have some time at hand. This could solve you dream.

  • Morgan
    Morgan Member Posts: 526 ✭✭✭

    PJ, I've just discovered AutoHotKey and been experimenting with it. I thought I was doing something cool until I found your code scattered through the forums. I'm really surprised your code hasn't gathered more interest, it really is amazing!

    I'm wondering if you've done anything to update your WorkFlow Code? I was hoping to launch different layouts from workflows that would launch with whatever the workflow had as it's original text. I see you have shortcuts for layouts, and code to launch individual resources to the workflow reference, but I haven't been able to combine them.

    If there's any other neat things you've been working on I'd love to see them!

  • ds. P.J. Kotze
    ds. P.J. Kotze Member Posts: 120 ✭✭

    Morgan said:

    If there's any other neat things you've been working on I'd love to see them!

    Morgan, 

    I have done many projects in ahk to perform certain tasks faster. The best of all for my workflow was to intercept the pdf printer to print my Sermons to Series folders and add a watermark. After that, all the necessary adjustments are made to get flstudio ready for recording the specific series. The automation saves about 10-15 minutes of work every time I export to pdf.

    I have since switched to the Mac environment as my windows laptop no longer wants to boot. All my workflows are now in AppleScript, Keyboard Maestro and Automator for Mac. Currently I will be able to help with advice, but unfortunately cannot test it.

    I installed windows on my MacBook in UTM. It's just incredibly slow. However, the possibilities on the Mac are so much more and easier that I no longer use windows at all. Everything is just faster. The only negative feedback is that the Logos Api is not available on Mac, but this can be overcome with inventive creativity.

    The opportunity is open for you to become an Ahk expert in Logos and windows and support the community with creative ideas.