Skip to content

Instantly share code, notes, and snippets.

@exnius
Created October 29, 2013 00:06
Show Gist options
  • Save exnius/7207042 to your computer and use it in GitHub Desktop.
Save exnius/7207042 to your computer and use it in GitHub Desktop.
Probando un método alternativo para PutText()... #AHK
PutText(String, Select := 0)
{
Length := StrLen(String)
If (Length < 1)
{
return
}
else if (Length < 30) {
SendRaw, %String%
}
else {
SoundPlay *64
;If (Clipboard = "")
IsClipEmpty := (Clipboard = "") ? 1 : 0
if !IsClipEmpty {
ClipboardBackup := Clipboard
While !(Clipboard = "") {
Clipboard =
Sleep, 20
}
}
Loop {
Clipboard := String
ClipWait, 1
Sleep, 20
if (Clipboard = String)
break
}
;ClipWait, 0.1, 1
Send, ^v
}
if (Select && Length < 200) ; parameter
{
StringReplace, String, String, `n, , All
SendInput, {ShiftDown}{Left %Length%}{ShiftUp}
}
Clipboard := ClipboardBackup
;if !IsClipEmpty
; ClipWait, 0.5, 1
Sleep, 10
;String :=
;ClipboardBackup :=
Return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment