⚡ Productivity

AutoHotkey v2 Script Writer for Office Staff: Hotstrings with Safe Trigger Prefixes, App Specific Hotkeys with #HotIf, Clipboard Macros, Date Math, and a v1 Syntax Check

Write a working AutoHotkey v2 script for a Windows office worker who types the same blocks all day: a trigger naming scheme that never fires by accident, hotstrings for signatures and dates, app specific hotkeys scoped with #HotIf, clipboard macros that restore what you had copied, a shortcut conflict check, a v1 to v2 syntax check, install and startup steps, and a test plan.

0.0
0Reviews
P
October 6, 2026

Prompt

Act as an AutoHotkey v2 developer who writes small, readable automation scripts for office staff on Windows, and who knows that most broken scripts online are v1 syntax pasted into v2.

Inputs:
- The person's role and the apps they type in, with process names if known (WINWORD.EXE, OUTLOOK.EXE): [AppsUsed]
- Text blocks they retype often (signatures, disclaimers, addresses, standard replies): [TextBlocks]
- Date or number formats they type (today, a deadline 14 days out, invoice numbers): [DateNeeds]
- Repeated multi step actions in a specific app: [AppActions]
- Tasks that start from selected or copied text: [ClipboardTasks]
- Shortcuts they already rely on in those apps: [ExistingShortcuts]
- Output format: [Format]

Generate:
1. A trigger plan: a prefix such as ] for every hotstring so normal typing never expands, a name for each item in TextBlocks and DateNeeds, and the hotstring options used (* for no ending character).
2. A conflict check: every proposed hotkey against ExistingShortcuts and common app defaults, with a replacement for any clash.
3. One complete v2 script starting with #Requires AutoHotkey v2.0 and #SingleInstance Force, grouped into labeled sections: global hotstrings, date hotstrings using FormatTime and DateAdd, app specific hotkeys for AppActions inside #HotIf WinActive("ahk_exe ...") blocks closed with #HotIf, and clipboard macros for ClipboardTasks.
4. Clipboard macros that save ClipboardAll(), clear A_Clipboard, send Ctrl+C, wait with ClipWait, act on the text, then restore the saved clipboard, with a message when nothing was selected.
5. A v1 syntax check listing what would break if pasted from an old forum post: commas after commands, %var% in expressions, Clipboard instead of A_Clipboard, #IfWinActive, and return ended hotkeys instead of braces.
6. Install and startup steps: install AutoHotkey v2, save the file as UTF-8 with an .ahk extension, run it, and put a shortcut in the shell:startup folder.
7. A test plan: each trigger, where to test it, and the expected result.

Constraints:
- Use SendText for literal text so symbols are not read as modifier keys.
- Never store passwords, client data, or login sequences in the script.
- Tell the user to confirm with their IT team before installing on a managed work computer. No em dashes.

Instructions

Replace every [bracket] with your details before running. Works on ChatGPT, Claude, and Gemini.

Generated Output

This image was generated using the prompt above.

AutoHotkey v2 Script Writer for Office Staff: Hotstrings with Safe Trigger Prefixes, App Specific Hotkeys with #HotIf, Clipboard Macros, Date Math, and a v1 Syntax Check - Result

Examples

Example Input

AppsUsed: paralegal at a small law firm; Microsoft Word (WINWORD.EXE), Outlook (OUTLOOK.EXE), a browser for the court e-filing portal
TextBlocks: email signature (Dana Ruiz, Paralegal, Ortega and Hale LLP, (555) 010-2244); confidentiality line for emails
DateNeeds: today written out (October 6, 2026); a date 14 days from today as MM/dd/yyyy for response deadlines
AppActions: in Word, insert a pleading signature block
ClipboardTasks: select a matter number in an Outlook email and turn it into 'Re: Matter No. 2026-CV-0412'; paste copied court text as plain text
ExistingShortcuts: Ctrl+Shift+V in Word, Win+V clipboard history
Format: script with comments, conflict check, v1 check, tests

Example Output

Trigger plan
Prefix ] for all hotstrings: ]sig signature, ]conf confidentiality line, ]dt today, ]d14 deadline, ]psig pleading block (Word only). Option * expands without Space or Enter.

Conflict check
Ctrl+Shift+V pastes formatting in Word and Win+V is clipboard history, so neither can be the plain text paste. Ctrl+Alt+V opens Paste Special, Ctrl+Alt+S splits the Word window, and Ctrl+Alt+M inserts a comment, and Outlook's message editor shares Word's keys. Use Ctrl+Alt+Shift+V and Ctrl+Alt+Shift+M, and make the pleading block a Word only hotstring. Press each new combo once in Word and Outlook before installing to confirm it does nothing by default.

LawOffice.ahk
#Requires AutoHotkey v2.0
#SingleInstance Force

; Global hotstrings
:*:]sig::
{
    SendText "Best regards,`nDana Ruiz`nParalegal, Ortega and Hale LLP`n(555) 010-2244"
}
:*:]conf::
{
    SendText "CONFIDENTIAL: attorney client privileged communication."
}

; Date hotstrings
:*:]dt::
{
    SendText FormatTime(, "MMMM d, yyyy")
}
:*:]d14::
{
    SendText FormatTime(DateAdd(A_Now, 14, "Days"), "MM/dd/yyyy")
}

; Paste as plain text, anywhere
^!+v::
{
    A_Clipboard := A_Clipboard  ; keeps text only
    Send "^v"
}

; Word only
#HotIf WinActive("ahk_exe WINWORD.EXE")
:*:]psig::
{
    SendText "Respectfully submitted,`n`n/s/ ____________`nCounsel for Plaintiff"
}
#HotIf

; Outlook only: selected matter number to a Re: line
#HotIf WinActive("ahk_exe OUTLOOK.EXE")
^!+m::
{
    saved := ClipboardAll()
    A_Clipboard := ""
    Send "^c"
    if !ClipWait(1) {
        A_Clipboard := saved
        MsgBox "Select the matter number first."
        return
    }
    ref := Trim(StrUpper(A_Clipboard))
    A_Clipboard := saved
    SendText "Re: Matter No. " ref
}
#HotIf

v1 syntax check
- Send, ^v (v1) becomes Send "^v"
- MsgBox, Select text becomes MsgBox "Select text"
- Clipboard becomes A_Clipboard
- #IfWinActive ahk_exe WINWORD.EXE becomes #HotIf WinActive("ahk_exe WINWORD.EXE")
- Multi line hotkeys ending in return need braces in v2

Install
Install AutoHotkey v2, save LawOffice.ahk as UTF-8, double click it, then press Win+R, type shell:startup, and place a shortcut to the file there. Ask IT first on a firm laptop.

Tests
| Trigger | Where | Expected |
| ]sig | Notepad | 4 line signature |
| ]d14 | Outlook | date 14 days out, MM/dd/yyyy |
| Ctrl+Alt+Shift+V after copying court text | Word | text pasted with no formatting |
| ]psig | Word | pleading signature block; stays as typed in Outlook |
| Ctrl+Alt+Shift+M with 2026-cv-0412 selected | Outlook | Re: Matter No. 2026-CV-0412 and old clipboard restored |
| Ctrl+Alt+Shift+M with nothing selected | Outlook | message box, clipboard unchanged |

Reviews (0)

Please login to leave a review.
Loading reviews...