# AutoHotkey

AutoHotkey is a scripting language for Windows that can create keyboard shortcuts, macros, and other automations.

# Middle Click Paste

WARNING

WARNING: This script is still under development and may not work in all use cases.

This script will enable the middle click of your mouse to paste the clipboard.


#IfWinNotActive ahk_class ConsoleWindowClass

~mbutton::
  WinGetClass cos_class, A
  if (cos_class == "Emacs")
    SendInput ^y
  else if (cos_class == "CASCADIA_HOSTING_WINDOW_CLASS")
    SendInput {Raw}%clipboard%
  else
    SendInput ^v
  return
  
#IfWinNotActive

;; clipx
^mbutton::
  sendinput ^+{insert}
  return

# Paste Into Command Prompt

This script will allow pasting into the command prompt application with Control + v.

WARNING

WARNING: This script is still under development and may not work in all use cases.

Source: Lowell Heddings

;
; AutoHotkey Version: 1.x
; Language:       English
; Author:         Lowell Heddings | geek@howtogeek.com
;
; Script Function:
;	enable paste in the Windows command prompt
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive ahk_class CASCADIA_HOSTING_WINDOW_CLASS
^V::
SendInput {Raw}%clipboard%
return
#IfWinActive

# Copy On Select & Middle Click Paste

WARNING

DANGER: This script has several issues and isn't useable in its current form.

This script's purpose is to allow all selected text to be copied as well as middle mouse click paste. However, it suffers from several bugs in its current form.

Source: AutoHotkey Forums

cos_mousedrag_treshold := 20 ; pixels

    
#IfWinNotActive ahk_class ConsoleWindowClass

~lButton::
  MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
  keywait lbutton
  mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
  if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
    or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
  {
    wingetclass cos_class, A
    if (cos_class == "Emacs")
      sendinput !w
    else
      sendinput ^c
  }
  return
  
~mbutton::
  WinGetClass cos_class, A
  if (cos_class == "Emacs")
    SendInput ^y
  else
    SendInput ^v
  return
  
#IfWinNotActive


;; clipx
^mbutton::
  sendinput ^+{insert}
  return