Page 1 of 1

Sendinput does not send variable contents if the strings begin with ";"

Posted: 29 Dec 2018, 06:18
by LC99

Code: Select all

; Tested with AutoHotKey L Version 1.1.29.1
; I've noticed others have experienced this problem as well
; but I think I stumbled on a work-around for the problem
; Line below is used to prefix every line of text on the clipboard with "; "
clipboard := RegExReplace(clipboard, "([^\n]+)", "; $1")  ; This works as shown by msgbox

; The Problem:
SendInput, ^v ; Doesn't paste anything
Sendinput, {Ctrl Down}v{Ctrl Up}  ; This pastes the prefixed text on the clipboard as expected

Re: Sendinput does not send variable contents if the strings begin with ";"

Posted: 29 Dec 2018, 06:58
by swagfag
cant reproduce on 1.1.30.1, though i doubt i would have been able to on 1.1.29.1 either

Re: Sendinput does not send variable contents if the strings begin with ";"

Posted: 29 Dec 2018, 09:38
by gregster
can't reproduce on 1.1.29.1 either

Well, if you run the script like this, there is probably no text field active at the moment the line SendInput ^v gets executed (and then it cannot paste anything, obviously) . But that would be true for the next line, too.
Try it as a hotkey procedure and activate some editor window (like Notepad) before you execute the code via the hotkey.
paste.jpg
paste.jpg (33.46 KiB) Viewed 1447 times
Works...

Re: Sendinput does not send variable contents if the strings begin with ";"

Posted: 29 Dec 2018, 11:47
by joefiesta
and, everything works fine on 1.1.28.