2021-07-08 08:16:21 +00:00
|
|
|
; CLIPBOARD
|
|
|
|
|
|
|
|
InitClipboardManager() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ConvertClipboardToPlainText() {
|
|
|
|
ClipBoard = %ClipBoard%
|
|
|
|
}
|
|
|
|
|
|
|
|
ConvertClipboardToUnixPath() {
|
|
|
|
ClipBoard := StrReplace(ClipBoard, "\", "/") ;
|
|
|
|
}
|
|
|
|
|
|
|
|
BorrowClipboard(funcName, params*) {
|
|
|
|
Clip0 = %ClipBoardAll%
|
|
|
|
result := %funcName%(params*)
|
|
|
|
ClipBoard = %Clip0%
|
|
|
|
VarSetCapacity(Clip0, 0) ; Free memory
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
PasteAsPlainText() {
|
|
|
|
BorrowClipboard("PasteAs", "ConvertClipboardToPlainText")
|
|
|
|
}
|
|
|
|
|
|
|
|
PasteAsUnixPath() {
|
|
|
|
BorrowClipboard("PasteAs", "ConvertClipboardToUnixPath")
|
|
|
|
}
|
|
|
|
|
|
|
|
PasteAs(convertFuncName) {
|
|
|
|
%convertFuncName%()
|
2021-07-08 14:14:13 +00:00
|
|
|
Paste()
|
2021-07-08 08:16:21 +00:00
|
|
|
Sleep 500
|
|
|
|
}
|
|
|
|
|
2021-07-08 14:14:13 +00:00
|
|
|
Copy() {
|
|
|
|
if WinActive("ahk_exe WindowsTerminal.exe") {
|
|
|
|
Send, ^+c
|
|
|
|
} else {
|
|
|
|
Send, ^c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Paste() {
|
|
|
|
if WinActive("ahk_exe WindowsTerminal.exe") {
|
|
|
|
Send, ^+v
|
|
|
|
} else {
|
|
|
|
Send, ^v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-08 08:16:21 +00:00
|
|
|
CopyAndFetch() {
|
|
|
|
Clipboard =
|
2021-07-08 14:14:13 +00:00
|
|
|
Copy()
|
2021-07-08 08:16:21 +00:00
|
|
|
ClipWait, 0, 1 ; wait until clipboard contains data
|
|
|
|
selection = %Clipboard% ; save the content of the clipboard
|
|
|
|
return selection
|
|
|
|
}
|
|
|
|
|
|
|
|
GetSelectedText() {
|
|
|
|
return BorrowClipboard("CopyAndFetch")
|
|
|
|
}
|
|
|
|
|
|
|
|
AlternativeCopy() {
|
|
|
|
global ALTERNATIVE_CLIPBOARD
|
|
|
|
ALTERNATIVE_CLIPBOARD := GetSelectedText()
|
|
|
|
}
|
|
|
|
|
|
|
|
AlternativePaste() {
|
|
|
|
BorrowClipboard("PasteAs", "LoadAlternativeToClipboard")
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadAlternativeToClipboard() {
|
|
|
|
global ALTERNATIVE_CLIPBOARD
|
|
|
|
Clipboard = %ALTERNATIVE_CLIPBOARD%
|
|
|
|
}
|
2021-07-08 14:14:13 +00:00
|
|
|
|
|
|
|
CopyClipboardToAlternative() {
|
|
|
|
global ALTERNATIVE_CLIPBOARD
|
|
|
|
ALTERNATIVE_CLIPBOARD = %ClipBoardAll%
|
|
|
|
}
|