Skip to content

Instantly share code, notes, and snippets.

@Saniee
Last active November 17, 2023 15:01
Show Gist options
  • Save Saniee/b295bf17d2f04ea9b3aed586af021447 to your computer and use it in GitHub Desktop.
Save Saniee/b295bf17d2f04ea9b3aed586af021447 to your computer and use it in GitHub Desktop.
AutoHotkey 2.0 Hotstring Script for speeding up typing, called typing helper.
#Requires AutoHotkey v2.0
#SingleInstance force
; Abbreviations, some are not in :*: due to them intercepting words.
:*:btw::by the way
::ik::I know
:*:idk::I don't know
::k::okay
:*:etc::etcetera
:*:tis::this
::ty::thank you
:*:sry::sorry
:*:thx::thanks
:*:ofc::of course
:*:fyi::for your information
:*:jk::just kidding
:*:tbh::to be honest
:*:imo::in my opinion
::dm::direct message
::np::no problem
:*:brb::be right back
:*:iirc::if I remember correctly
:*:wth::what the hell
::rp::roleplay
:*:gtg::gotta go
:*:aight::alright
::yk::you know
::u::you
::tf::the fuck
:*:irl::in real life
::rn::right now
::hf::have fun
:*:sec::second
; Time Abbreviations
:*:]utc::universal time coordinated
:*:]cst::central standard time
:*:]est::eastern standard time
:*:]pst::pacific standard time
:*:]am::before noon
:*:]pm::after noon
; Spelling
:*:its::it's
:*:cant::can't
:*:dont::don't
:*:thats::that's
:*:wont::won't
:*:wouldnt::wouldn't
:*:didnt::didn't
:*:hasnt::hasn't
:*:havent::haven't
:*:lets::let's
:*:couldnt::couldn't
:*:wasnt::wasn't
configPath := A_ScriptDir "\typingHelperConfig.ini"
if (FileExist(configPath)) {
email := IniRead(configPath, "Email", "emailValue")
dateandtimeString := IniRead(configPath, "AutoCompleteStrings", "datetimeAutocomplete")
emailString := IniRead(configPath, "AutoCompleteStrings", "emailAutocomplete")
optionGuiHotkeyold := IniRead(configPath, "Hotkeys", "guiHotkey")
toggleAllHotkeyold := IniRead(configPath, "Hotkeys", "toggleAllHotkey")
} else {
email := "@gmail.com"
dateandtimeString := "]d"
emailString := "e@"
optionGuiHotkeyold := "!+c"
toggleAllHotkeyold := "!+t"
}
Hotstring(":*:" dateandtimeString, SendDateandTime)
Hotstring(":*:" emailString, SendEmail)
SendEmail(*) {
Send(Format("{1}", email))
}
SendDateandTime(*) {
Send(FormatTime("m/d/yyyy h:mm tt"))
}
toggleAllBool := false
Hotkey optionGuiHotkeyold, OpenGui
Hotkey toggleAllHotkeyold, ToggleAll
; 'fancy' UI for configuring different functions of this script.
MainGui := Gui(, "typingHelper Options GUI")
toggleAllBtn := MainGui.AddButton(, "Turn On/Off All")
abbCheckbox := MainGui.AddCheckbox("Checked", "Change Abbreviations?")
tabbCheckbox := MainGui.AddCheckbox("Checked", "Change Time Abbreviations?")
spCheckBox := MainGui.AddCheckbox("Checked", "Fix Spelling?")
emCheckbox := MainGui.AddCheckbox("Checked", "Email Autocomplete?")
emAutoCompleteEdit := MainGui.AddEdit()
dtCheckbox := MainGui.AddCheckbox("Checked", "Date and Time Autocomplete?")
dtAutoCompleteEdit := MainGui.AddEdit()
emailEdit := MainGui.AddEdit("x205 y177 w125")
svSettingsBtn := MainGui.AddButton("x415 y176", "Save Settings")
MainGui.AddText("x10 y180", "Edit to have your E-Mail AutoCompleted:")
MainGui.AddText("x200 y8", "Change Hotkey for opening the GUI:")
MainGui.AddText("x190 y38", "Change Hotkey for Toggling Functions:")
toggleAllHotkey := MainGui.AddHotkey("x375 y35", toggleAllHotkeyold)
optionGuiHotkey := MainGui.AddHotkey("x375 y5", optionGuiHotkeyold)
updateHotkeybtn := MainGui.AddButton("x412 y60", "UpdateHotkeys")
MainGui.AddText("x267 y90", "To open this GUI Again press the Hotkey Above")
MainGui.AddText("x135 y112", "Edit Email Autocomplete String")
MainGui.AddText("x135 y160", "Edit Date and Time Autocomplete String")
abbCheckbox.OnEvent("Click", ToggleAbbreviations)
tabbCheckbox.OnEvent("Click", ToggleTimeAbbreviations)
spCheckBox.OnEvent("Click", ToggleSpelling)
dtCheckbox.OnEvent("Click", ToggleDate)
emCheckbox.OnEvent("Click", ToggleEmail)
emailEdit.OnEvent("Change", editEmail)
toggleAllBtn.OnEvent("Click", ToggleAll)
svSettingsBtn.OnEvent("Click", SaveSettings)
updateHotkeybtn.OnEvent("Click", UpdateAllHotkeys)
if (FileExist(configPath)) {
emailEdit.Text := email
emAutoCompleteEdit.Value := IniRead(configPath, "AutoCompleteStrings", "emailAutocomplete")
dtAutoCompleteEdit.Value := IniRead(configPath, "AutoCompleteStrings", "datetimeAutocomplete")
} else {
emailEdit.Text := "@gmail.com"
emAutoCompleteEdit.Value := "e@"
dtAutoCompleteEdit.Value := "]d"
}
UpdateAllHotkeys(*) {
global optionGuiHotkeyold
global toggleAllHotkeyold
Hotkey optionGuiHotkeyold, "Off"
optionGuiHotkeyold := optionGuiHotkey.Value
Hotkey toggleAllHotkeyold, "Off"
toggleAllHotkeyold := toggleAllHotkey.Value
Hotkey optionGuiHotkey.Value, OpenGui
Hotkey toggleAllHotkey.Value, ToggleAll
}
SaveSettings(*) {
configPath := A_ScriptDir "\typingHelperConfig.ini"
if (!FileExist(configPath)) {
FileAppend "Hotkey Edit Help`n! - Alt, + - Shift, ^ - Ctrl, # - Windows Key`n{Example, #N - Activates on pressing Windows + N}`n`n", configPath
}
; Email
IniWrite(emailEdit.Value, configPath, "Email", "emailValue")
; Autocomplete Strings
IniWrite(emAutoCompleteEdit.Value, configPath, "AutoCompleteStrings", "emailAutocomplete")
IniWrite(dtAutoCompleteEdit.Value, configPath, "AutoCompleteStrings", "datetimeAutocomplete")
; Hotkeys
IniWrite(optionGuiHotkey.Value, configPath, "Hotkeys", "guiHotkey")
IniWrite(toggleAllHotkey.Value, configPath, "Hotkeys", "toggleAllHotkey")
IniWrite(true, configPath, "Hints", "openConfigHint")
If (!InStr(FileExist(configPath), "H")) {
FileSetAttrib("+H", configPath)
}
}
OpenGui(*) {
MainGui.Show("w500 h200")
}
ToggleAll(*) {
global toggleAllBool
if (toggleAllBool == false) {
abbCheckbox.Value := 0
tabbCheckbox.Value := 0
spCheckBox.Value := 0
emCheckbox.Value := 0
dtCheckbox.Value := 0
Sleep 100 ;
ToggleAbbreviations
ToggleTimeAbbreviations
ToggleSpelling
ToggleEmail
ToggleDate
toggleAllBool := true
} else {
abbCheckbox.Value := 1
tabbCheckbox.Value := 1
spCheckBox.Value := 1
emCheckbox.Value := 1
dtCheckbox.Value := 1
Sleep 100 ;
ToggleAbbreviations
ToggleTimeAbbreviations
ToggleSpelling
ToggleEmail
ToggleDate
toggleAllBool := false
}
}
; Abbreviations Toggle Func
ToggleAbbreviations(*) {
if (abbCheckbox.Value == 1) {
Hotstring "::btw", , "On"
Hotstring "::ik", , "On"
Hotstring "::k", , "On"
Hotstring "::idk", , "On"
Hotstring "::etc", , "On"
Hotstring "::tis", , "On"
Hotstring "::ty", , "On"
Hotstring "::sry", , "On"
Hotstring "::thx", , "On"
Hotstring "::ofc", , "On"
Hotstring "::fyi", , "On"
Hotstring "::jk", , "On"
Hotstring "::tbh", , "On"
Hotstring "::imo", , "On"
Hotstring "::dm", , "On"
Hotstring "::np", , "On"
Hotstring "::brb", , "On"
Hotstring "::iirc", , "On"
Hotstring "::wth", , "On"
Hotstring "::rp", , "On"
Hotstring "::gtg", , "On"
Hotstring "::aight", , "On"
Hotstring "::yk", , "On"
Hotstring "::u", , "On"
Hotstring "::hasnt", , "On"
Hotstring "::havent", , "On"
Hotstring "::tf", , "On"
Hotstring "::irl", , "On"
Hotstring "::rn", , "On"
Hotstring "::hf", , "On"
Hotstring "::sec", , "On"
} else {
Hotstring "::btw", , "Off"
Hotstring "::ik", , "Off"
Hotstring "::k", , "Off"
Hotstring "::idk", , "Off"
Hotstring "::etc", , "Off"
Hotstring "::tis", , "Off"
Hotstring "::ty", , "Off"
Hotstring "::sry", , "Off"
Hotstring "::thx", , "Off"
Hotstring "::ofc", , "Off"
Hotstring "::fyi", , "Off"
Hotstring "::jk", , "Off"
Hotstring "::tbh", , "Off"
Hotstring "::imo", , "Off"
Hotstring "::dm", , "Off"
Hotstring "::np", , "Off"
Hotstring "::brb", , "Off"
Hotstring "::iirc", , "Off"
Hotstring "::wth", , "Off"
Hotstring "::rp", , "Off"
Hotstring "::gtg", , "Off"
Hotstring "::aight", , "Off"
Hotstring "::yk", , "Off"
Hotstring "::u", , "Off"
Hotstring "::hasnt", , "Off"
Hotstring "::havent", , "Off"
Hotstring "::tf", , "Off"
Hotstring "::irl", , "Off"
Hotstring "::rn", , "Off"
Hotstring "::hf", , "Off"
Hotstring "::sec", , "Off"
}
}
; Time Abbreviations Toggle Func
ToggleTimeAbbreviations(*) {
if (tabbCheckbox.Value == 1) {
Hotstring ":*:]utc", , "On"
Hotstring ":*:]cst", , "On"
Hotstring ":*:]est", , "On"
Hotstring ":*:]pst", , "On"
Hotstring ":*:]am", , "On"
Hotstring ":*:]pm", , "On"
} else {
Hotstring ":*:]utc", , "Off"
Hotstring ":*:]cst", , "Off"
Hotstring ":*:]est", , "Off"
Hotstring ":*:]pst", , "Off"
Hotstring ":*:]am", , "Off"
Hotstring ":*:]pm", , "Off"
}
}
; Spelling Toggle Func
ToggleSpelling(*) {
if (spCheckBox.Value == 1) {
Hotstring "::its", , "On"
Hotstring "::cant", , "On"
Hotstring "::dont", , "On"
Hotstring "::thats", , "On"
Hotstring "::wont", , "On"
Hotstring "::wouldnt", , "On"
Hotstring "::didnt", , "On"
Hotstring "::hasnt", , "On"
Hotstring "::lets", , "On"
Hotstring "::couldnt", , "On"
Hotstring "::wasnt", , "On"
} else {
Hotstring "::its", , "Off"
Hotstring "::cant", , "Off"
Hotstring "::dont", , "Off"
Hotstring "::thats", , "Off"
Hotstring "::wont", , "Off"
Hotstring "::wouldnt", , "Off"
Hotstring "::didnt", , "Off"
Hotstring "::hasnt", , "Off"
Hotstring "::lets", , "Off"
Hotstring "::couldnt", , "Off"
Hotstring "::wasnt", , "Off"
}
}
; Toggle Date Autocomplete
ToggleDate(*) {
global dateandtimeString
if (dtCheckbox.Value == 1) {
Hotstring ":*:" dateandtimeString, , "On"
} else {
Hotstring ":*:" dateandtimeString, , "Off"
}
}
; Email Autocomplete Toggle Func
ToggleEmail(*) {
global emailString
if (emCheckbox.Value == 1) {
Hotstring ":*:" emailString, , "On"
} else {
Hotstring ":*:" emailString, , "Off"
}
}
; Email Edit Funcs
editEmail(*) {
global email
email := emailEdit.Value
}
; Open Config UI on launch.
MainGui.show("w500 h200")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment