; Set your trigger key here (e.g., F13) global IsRunning := false ;Mute Discord and send a message to claude F1:: { global IsRunning ; If the script is already in the middle of a press, do nothing if (IsRunning) return IsRunning := true ; Mark as running ; --- STEP 1: ON PRESS --- ; Mute Discord (Assumes Ctrl+Shift+M is set in Discord) if WinExist("Journeys through Oryndor - Discord") { WinActivate Send "^+m" } else { exit } Sleep 100 ; Focus Claude (Assumes Claude is open in a browser tab) SetTitleMatchMode 3 if WinExist("Claude") WinActivate SetTitleMatchMode 2 Sleep 100 ; Short pause for window focus ; Start Recording in Claude (Ctrl+D) Send "^d" ; Wait for you to release the key KeyWait "F1" ; --- STEP 2: ON RELEASE --- ; Stop Recording / Send (Ctrl+D again or Enter) Send "^d" Sleep 200 Send "{Enter}" Sleep 300 ; Switch back to Discord if WinExist("ahk_exe Discord.exe") WinActivate ; Unmute Discord Send "^+m" IsRunning := false } #Requires AutoHotkey v2.0 #SingleInstance Force MD_FILE := "C:\Users\Isaiah.Frank.Maranatha\Documents\Oryndor\1- WIP\Vendor Character Table.md" F2::{ global MD_FILE if !FileExist(MD_FILE) { MsgBox "Not found: " MD_FILE return } content := StrReplace(FileRead(MD_FILE, "UTF-8"), "`r", "") ; Isolate the "## Playing the Traits" section if !RegExMatch(content, "ms)^##\s+Playing the Traits[^\n]*\n(.*?)(?=\n##\s|\z)", &outer) { MsgBox "Could not locate '## Playing the Traits' section." return } body := outer[1] ; Parse "### Scale" blocks in document order scales := [] ; ordered list of scale names scaleMap := Map() ; scaleName -> Map(level -> text) pos := 1 while pos := RegExMatch(body, "ms)^###\s+([^\n]+)\n(.*?)(?=\n###\s|\z)", &s, pos) { name := Trim(s[1]) sub := s[2] levels := Map() sp := 1 while sp := RegExMatch(sub, "ms)^####\s+([123])[^\n]*\n(.*?)(?=\n####\s|\z)", &l, sp) { levels[l[1]] := Trim(l[2], " `t`r`n") sp += l.Len } scales.Push(name) scaleMap[name] := levels pos += s.Len } if scales.Length < 5 { MsgBox "Expected 5 scales, found " scales.Length "." return } rolls := [] out := "" Loop 5 { r := Random(1, 3) rolls.Push(r) name := scales[A_Index] text := scaleMap[name].Has(String(r)) ? scaleMap[name][String(r)] : "[MISSING " name " " r "]" out .= "── " name " (" r ") ──`n" text "`n`n" } header := "Vendor Roll: " for i, v in rolls header .= scales[i] " " v (i < 5 ? " | " : "") header .= "`n──────────────────────────────`n`n" output := header . out A_Clipboard := output Show(output) } Show(text) { g := Gui("+AlwaysOnTop +Resize", "Vendor Roll") g.SetFont("s10", "Consolas") g.AddEdit("w760 h500 ReadOnly +Wrap", text) g.AddText("xm", "Copied to clipboard. Esc to close.") g.OnEvent("Escape", (*) => g.Destroy()) g.OnEvent("Close", (*) => g.Destroy()) g.Show() }