0

1

The helpful script #1

So, this is the AHK script that can help build a prompt using the keywords you define yourself! You can copy the code and save it into something.ahk (you'll need to install AutoHotkey to build it into an .exe). It uses the Ctrl+Alt+V hotkey by default, but you can change it.

#Requires AutoHotkey v2.0

^!v::
{
    oldClipboard := ClipboardAll()

    A_Clipboard := ""
    Send "^c"

    if !ClipWait(2)
    {
        MsgBox "Failed to copy the selected text."
        return
    }

    text := A_Clipboard

    dictionaryFile := A_ScriptDir "\dictionary.ini"
    valuesFolder := A_ScriptDir "\values"

    dictionary := Map()

    keys := IniRead(dictionaryFile, "Dictionary")

    for line in StrSplit(keys, "`n", "`r")
    {
        line := Trim(line)

        if line = "" || SubStr(line, 1, 1) = ";"
            continue

        parts := StrSplit(line, "=", , 2)

        if parts.Length < 2
            continue

        keyword := Trim(parts[1])
        fileName := Trim(parts[2])
        valueFile := valuesFolder "\" fileName

        if FileExist(valueFile)
            dictionary[keyword] := FileRead(valueFile, "UTF-8")
    }

    additions := ""

    for keyword, value in dictionary
    {
        if InStr(text, keyword, false)
            additions .= RTrim(value) "`r`n"
    }

    if additions != ""
        text := RTrim(text) "`r`n`r`n" RTrim(additions)

    A_Clipboard := text
    Send "^v"

    Sleep 300
    A_Clipboard := oldClipboard
}

You'll also need dictionary.ini (that's where your keywords are stored) and the values folder in the same folder as the script. Typical dictionary.ini:

[Dictionary]
Util-sama=util-sama.txt
Hector=hector.txt
Ramylen=ramylen.txt
...

Notice that it has the format Keyword (case-insensitive)=file.txt. Here, file.txt is the .txt file with the piece of the prompt that is stored in the values folder.

Profilbild