ChatGPT helps building PBs

NichtnurBibelleser
NichtnurBibelleser Member Posts: 574 ✭✭✭

I had to create a PB for the "Katechismus der Katholischen Kirche" as it is not carried by Logos (see here).

After adding 200 milestones manually, I thought I give ChatGPT a try asking it to build a Macro for MS Word in order to automate the process. It works!
Questions:

a) Anyone interested that I share the Macro Code here?

b) Is a) allowed?

c) As asked already in the other thread (without response until now) @Logos Officials:
Is it possible = allowed to share my PB KKK here in the Forum?

Comments

  • Justin Gatlin
    Justin Gatlin Member, MVP Posts: 2,249
    edited April 10

    People have shared macros in the past, so I do not see why there would be a problem. You can also share personal books that are public domain and that are not sold by Logos.

    KKK has a very different meaning in the southern US and I had to go back and read your post again. 🤣

  • Francis
    Francis Member Posts: 3,987 ✭✭✭

    @NichtnurBibelleser as you share, can you give me details as to what exactly it does. There are different types of milestones that can be set up. Just to have the right expectations for what your macro does.

  • NichtnurBibelleser
    NichtnurBibelleser Member Posts: 574 ✭✭✭

    First, I had a Word document with the Text of the KKK (online for free at http://www.vatican.va ) and identified the correct format of the Milestones, which would be like "[[@CCC:CCC 1]] "

    Then, I went to https://chatgpt.com

    It adressed me in German. I asked the following question:

    Das Dokument enthält am Beginn von Abschnitten Zahlen zwischen 200 und 3000. Ich brauche ein Makro, das vor jeder Zahl folgenden Text einbaut: "[[@CCC:CCC xxx]] ", wobei xxx durch die Zahl, die nach dem Leerschlag folgt, ersetzt werden soll.

    It resulted the following text:

    Sub AddTextBeforeNumber()
    Dim para As Paragraph
    Dim rng As Range
    Dim number As Long
    Dim regex As Object
    Dim match As Object
    ' Erstellen eines regulären Ausdrucks, um Zahlen zwischen 200 und 3000 zu finden
    Set regex = CreateObject("VBScript.RegExp")
    regex.IgnoreCase = True
    regex.Global = True
    regex.Pattern = "\b([2-9][0-9]{2}|[12][0-9]{3}|3000)\b" ' Zahlen zwischen 200 und 3000
    
    ' Durchlaufe alle Absätze im Dokument
    For Each para In ActiveDocument.Paragraphs
        Set rng = para.Range
        
        ' Finde alle Zahlen, die dem Muster entsprechen
        If regex.Test(rng.Text) Then
            Set match = regex.Execute(rng.Text)
            
            ' Füge vor jeder gefundenen Zahl den gewünschten Text ein
            For Each m In match
                number = m.Value
                rng.InsertBefore "[[@CCC:CCC " & number & "]] "
            Next m
        End If
    Next para
    
    End Sub
    

    Then, the site automatically gave an explanation:

    Erklärung:
    • Das Makro durchsucht jeden Absatz im Dokument nach Zahlen im Bereich zwischen 200 und 3000.
    • Es verwendet reguläre Ausdrücke (regex), um nach diesen Zahlen zu suchen.
    • Wenn eine Zahl gefunden wird, fügt es den Text [[@CCC:CCC xxx]] direkt vor dieser Zahl ein, wobei xxx durch die Zahl ersetzt wird.
    Schritte zum Einfügen des Makros:
    1. Öffne MS Word.
    2. Drücke Alt + F11, um den VBA-Editor zu öffnen.
    3. Klicke im Menü auf Einfügen und dann auf Modul, um ein neues Modul zu erstellen.
    4. Kopiere den obenstehenden Code und füge ihn in das Modul ein.
    5. Schließe den VBA-Editor.
    6. Um das Makro auszuführen, drücke Alt + F8, wähle das Makro AddTextBeforeNumber und klicke auf Ausführen.
    Das Makro sollte dann den gewünschten Text vor jeder Zahl im Dokument einfügen.

    Only to demonstrate the capability of the tool. I could imagine to use a similar procedure for adding other Milestones in German PBs like the Works of Homer, Vergil etc.

  • NichtnurBibelleser
    NichtnurBibelleser Member Posts: 574 ✭✭✭

    KKK has a very different meaning in the southern US and I had to go back and read your post again. 🤣

    No offense intended. In German Theology it is the abbrevation used by everyone, see e.g. the (Protestant) RGG4's Table of Abbrevations:

  • Justin Gatlin
    Justin Gatlin Member, MVP Posts: 2,249

    No offense at all! I just did a double-take because of the cultural difference. I appreciate you sharing the macro.

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

    @NichtnurBibelleser, I was 100% sure you were spot on and meant no offense. I thought it was interesting that @Justin Gatlin's reaction was similar to mine, instinctively.

    Thank you for sharing your experience with AI generated code.

  • Fabian
    Fabian Member Posts: 1,097 ✭✭✭
    edited April 10

    Vielen Dank,

    Ich habe mal ein User Tool gemacht für Accordance. Aber noch nicht für Logos. ich werde dein Script ausprobieren.

    Grüsse

    Fabian

    Χριστὸς ἐν ὑμῖν, ἡ ἐλπὶς τῆς δόξης· 

  • NB.Mick
    NB.Mick MVP Posts: 16,243

    I'm not sure ChatGPT got that right. Your prompt instructed it to only look for the numbers at the beginning of paragraphs, while the code seems to look for any appearance of three to four-digit numbers in the range, which would put way too many milestones into the document, especially where years and some citations of DS numbers are mentioned.

    Have joy in the Lord! Smile

  • NichtnurBibelleser
    NichtnurBibelleser Member Posts: 574 ✭✭✭

    In fact, I got kind of 5 errors for duplicate entries due to Year numbers, which I corrected manually.

    I'd love to share the final result, but I hesitate to do so until some Logos Official green lights this.

    The point I wanted to make is only how incredibly easy it is to insert Milestones in an already existing Word document. And encourage anyone to try doing similar (maybe better) requests in an third party AI. This could skyrocked the creation of PBs IMHO.

  • Mattillo
    Mattillo Member Posts: 6,232 ✭✭✭✭

    I am very curious how to do this, but I do not understand German. Does anyone have an English version that works?

  • DAL
    DAL Member Posts: 10,851 ✭✭✭

    LOL Like those Australian guys disguised in white KKK gowns and masks and they didn’t know that was offensive 😂😂😂

  • Fabian
    Fabian Member Posts: 1,097 ✭✭✭

    See here https://www.vatican.va/archive/ccc/index_ge.htm Several languages. Original is the Latin one, as this is the official language for the Catholic church papers.

    Χριστὸς ἐν ὑμῖν, ἡ ἐλπὶς τῆς δόξης· 

  • Francis
    Francis Member Posts: 3,987 ✭✭✭

    b) Is a) allowed?

    @NichtnurBibelleser Logos has given capability to build personal books to its users, so it is generally allowed to do so. However, since it is illegal and unethical to reproduce copyrighted materials without permission instead of buying them, it follows that such materials should not be shared. This is a general statement about personal books, not about KKK in particular.

    Beyond this, Logos users can take other elements in consideration to decide whether to share public domain or open source materials as personal books:

    • Logos sells a good number of public domain works. Offering a PB can take some revenue away from them. Not saying that this alone is reason not to use or share PBs, it's just a consideration one can assess personally.
    • When Logos sells that book, it will often be more thoroughly built and have better functionality (esp. research editions). Users who prefer to use PBs to save money should take this into consideration.
    • PBs have limitations that other Logos books do not have. For instance, they do not sync across devices and afaik are only saved locally, not on your Logos account in the cloud. I could be wrong about this, but I think that if someone deletes a PB accidentally and then rebuilds it, annotations and highlights will not transfer automatically.

    The bottom-line is that Logos cannot legally forbid its users to create and share personal books if these books can be legally used and shared for free.

  • Scott
    Scott Member Posts: 210 ✭✭✭

    I stopped at OP's KKK reference and said, "Wuuut?".

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