Last active
January 10, 2024 16:40
-
-
Save creativenull/d1ddfd5c3964476c6f47f1384ead8b27 to your computer and use it in GitHub Desktop.
ahk v2 script to copy txt file into clipboard for WSL
This file contains hidden or 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
; Since I disable interop in WSL, this means I isolate my VM from Windows | |
; but copy pasting between WSL and Windows is also isolated. | |
; It's easier to copy from Windows to WSL via `Shift + Ins` | |
; but not easy to copy from WSL to Window, hence this autohotkey v2 script. | |
; Pressing `Win + V` will read a txt file that WSL can write to, and | |
; add to the clipboard. Save the old clipboard contents that I can | |
; still use `Ctrl + V` to paste the original copied content. | |
#v:: | |
{ | |
OldClipboard := ClipboardAll() | |
A_Clipboard := FileRead("C:\Users\<username>\_wsl_clipboard.txt") | |
Send "^v" | |
A_Clipboard := OldClipboard | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment