Skip to content

tazztone/ahk_scripter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

AHK v2 Key Remapper

A simple AutoHotkey v2 script that creates a graphical user interface (GUI) for creating custom keyboard shortcuts that insert specified text.

How to Use

run "scripter.ahk"

image

enter key combo enter desired text

image

it creates a file "remap.ahk", or if it already exists: appends your shortcuts at the end.

image

💡want autostart with windows? put a shortcut to this file into your windows startup folder ( hit "Win + R" and enter "shell:startup" to find it)

to have the GUI window appear again: run the "scripter.ahk"

Features

  • Create custom hotkeys with your desired key combinations
  • Assign text to be automatically typed when the hotkey is pressed
  • Saves hotkeys to a file (remap.ahk) for persistent use
  • User-friendly GUI interface
  • Validates input to ensure both key combination and text are provided
  • Provides confirmation messages for successful hotkey creation

Requirements

Saved Hotkeys

  • Hotkeys are appended to remap.ahk in the same directory
  • To use saved hotkeys in future sessions:
    1. Run remap.ahk directly, or
    2. Include it in another script with #Include remap.ahk
  • Each new hotkey is added on a new line

Code:

#Requires AutoHotkey v2.0

; Create the GUI
MyGui := Gui()
MyGui.Title := "AHK v2 Key Remapper"

; Add input fields
MyGui.Add("Text", "x10 y10 w200", "Enter key combination:")
keyCombo := MyGui.Add("Hotkey", "x10 y30 w200 vKeyCombo")

MyGui.Add("Text", "x10 y60 w200", "Enter text to insert:")
textInput := MyGui.Add("Edit", "x10 y80 w200 h60 vTextInput")

; Add a button to create the hotkey
MyGui.Add("Button", "x10 y150 w100", "Create Hotkey").OnEvent("Click", CreateHotkey)

; Show the GUI
MyGui.Show()

; Function to create the hotkey and save it to remap.ahk
CreateHotkey(*)
{
    submitted := MyGui.Submit()
    combo := submitted.KeyCombo
    text := submitted.TextInput
    
    if (combo != "" and text != "") {
        ; Create the hotkey
        Hotkey(combo, (*) => SendInput(text))
        
        ; Save the hotkey to remap.ahk with proper string formatting
        FileAppend("`n" . combo . "::SendInput(" . Chr(34) . text . Chr(34) . ")", "remap.ahk")
        
        MsgBox("Hotkey created and saved: " . combo . " will insert: " . text)
    } else {
        MsgBox("Please enter both a key combination and text.")
    }
}


#Requires AutoHotkey v2.0

; Creates a GUI with input fields for hotkey and text
; Validates input
; Creates immediate hotkey using Hotkey()
; Saves to file with proper AHK syntax

About

GUI for creating autohotkey script that remaps key combos to type your email address for example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published