Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created November 16, 2022 16:41
Show Gist options
  • Save JoeGlines/a59ef961350110e2f988e39664cd9136 to your computer and use it in GitHub Desktop.
Save JoeGlines/a59ef961350110e2f988e39664cd9136 to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey courses.
;They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance,Force ;only allow one instance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetBatchLines,-1 ;run the script as fast as possible
Setkeydelay,0 ;reduce key delay to smallest time period
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.
SendMode, Input ; Recommended for new scripts due to its superior speed and reliability.
F5::Send, AbCdEfGhIjKlMnOpQrStUvWxYz
;When you have a lot of text you're sending, pasting is often a superior approach
F6::Sender("AbCdEfGhIjKlMnOpQrStUvWxYz") ;use a function to paste the text w/o losing clipboard
F7::Sender("Joe`nWas`nHere")
;********************Function for sending text***********************************
Sender(Text){
ClipBackup:=ClipboardAll ;backup clipboard so you can restore later
Clipboard:="" ;blank the clipboard
Clipboard:=Text ;Set clipboard to text that was passed
ClipWait, 1 ;wait for the clipboard to have text
Send ^v ;Send paste
Sleep, 300 ;Wait (if you restore clipboard too fast, bad things happen)
Clipboard:=ClipBackup ;Restore clipboard
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment