14

This is a super simple thing I am trying to get my head around

I want to use something like WINKEY + ALT + C to paste ** - words** so that I can sign-off my posts or whatever using the three-key combo

Ratan Uday Kumar
  • 5,738
  • 6
  • 35
  • 54
user3045055
  • 143
  • 1
  • 1
  • 5

2 Answers2

22

Not sure what exactly you want, maybe something like this?

Press WINKEY + ALT + C to paste the clipboard contents:

#!c::
  SendInput, ^v
Return

Press WINKEY + ALT + C to paste "Some random text"

#!c::
  SendInput, Some random text
Return
Forivin
  • 14,780
  • 27
  • 106
  • 199
1

Instead of Sendinput which will type each characters you can use a clipboard paste approach. See for example https://github.com/tdalon/ahk/blob/59a8ab2a8fd497b4a5b5a85e73e32ff95d5d4425/Lib/Clip.ahk

Clip_Paste(sText,restore := True) {
; Syntax: Clip_Paste(sText,restore := True)
If (restore)
    ClipBackup:= ClipboardAll
Clipboard := sText
WinClip.Paste()
If (restore) 
    Clip_Restore(ClipBackup)
} ; eofun

; ---------------------------------------------------------------------------
Clip_Restore(ClipBackup) {
Clip_Wait() ; in order not to overwrite running clipboard action like pasting
Clipboard:= ClipBackup
} ;eofun
; ---------------------------------------------------------------------------
Clip_Wait(){
Sleep, 150
while DllCall("user32\GetOpenClipboardWindow", "Ptr")
    Sleep, -1
} ; eofun
Thierry Dalon
  • 779
  • 5
  • 21