Last active
November 28, 2021 06:26
-
-
Save divinity76/c50513750d2dde36dc42ae8f19b8b5f6 to your computer and use it in GitHub Desktop.
autoit KVM paste
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AutoItSetOption("SendKeyDelay",20); dont send too fast | |
AutoItSetOption("SendKeyDownDelay",20);; dont send too fast | |
Func TranslateNorwegianKeyboardLayoutToEnglish($str) | |
; warning: important to do translations in correct order, | |
; for example: \ => ' must be done BEFORE = => \ | |
; a proper fix would be strtr() instead of StringReplace, but i don't have a strtr in AutoIt | |
; and cba writing one, at least right now | |
$str = StringReplace ( $str, ":", "{SHIFTDOWN}ø{SHIFTUP}" ); | |
$str = StringReplace ( $str, "|", "{SHIFTDOWN}<{SHIFTUP}" ); | |
$str = StringReplace ( $str, "-", "{+}" ); | |
$str = StringReplace ( $str, "/", "-" ); | |
$str = StringReplace ( $str, "\", "'" ); | |
$str = StringReplace ( $str, "=", "\" ); | |
; LOTS more should be on this list, but i dont know what they are. | |
return $str; | |
EndFunc | |
Func Paste() | |
Sleep(2000); | |
Local $str = ClipGet(); | |
$str = TranslateNorwegianKeyboardLayoutToEnglish($str); | |
$str = StringReplace( StringReplace( $str , @CRLF, "{ENTER}"), @LF, "{ENTER}"); | |
Send($str); | |
EndFunc | |
HotKeySet("æ","Paste"); | |
While 1 | |
Sleep(2000); | |
WEnd | |
;: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment