Created
August 24, 2013 03:51
-
-
Save aviaryan/6325952 to your computer and use it in GitHub Desktop.
Temporary Clipboards for use with Clipjump - Provides shortcuts to capture data to another private Clipboard.
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
;--------------------------------------- | |
;TEMPORARY SYSTEM CLIPBOARD FOR CLIPJUMP | |
;v0.1 | |
;--------------------------------------- | |
;The shortcuts are Alt+C , X , V | |
!C:: | |
copy("^c") | |
return | |
!V:: | |
CjControl(2) | |
Clipboard := clip | |
Send, ^v | |
CjControl(1) | |
return | |
!X:: | |
copy("^x") | |
return | |
copy(key){ | |
global | |
CjControl(2) | |
Send, ^c | |
clip := ClipboardAll | |
CjControl(1) | |
} | |
;#Include ClipjumpCommunicator.ahk | |
;---------------------------- ClipjumpCommunicator.ahk --------------------------------------------- | |
CjControl(ByRef Code) | |
{ | |
global | |
local IsExe, TargetScriptTitle, CopyDataStruct, Prev_DetectHiddenWindows, Prev_TitleMatchMode, Z, S | |
if ! (IsExe := CjControl_check()) | |
return -1 ;Clipjump doesn't exist | |
TargetScriptTitle := "Clipjump" (IsExe=2 ? ".ahk ahk_class AutoHotkey" : ".exe ahk_class AutoHotkey") | |
VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0) | |
SizeInBytes := (StrLen(Code) + 1) * (A_IsUnicode ? 2 : 1) | |
NumPut(SizeInBytes, CopyDataStruct, A_PtrSize) | |
NumPut(&Code, CopyDataStruct, 2*A_PtrSize) | |
Prev_DetectHiddenWindows := A_DetectHiddenWindows | |
Prev_TitleMatchMode := A_TitleMatchMode | |
DetectHiddenWindows On | |
SetTitleMatchMode 2 | |
Z := 0 | |
while !Z | |
{ | |
SendMessage, 0x4a, 0, &CopyDataStruct,, %TargetScriptTitle% | |
Z := ErrorLevel | |
} | |
DetectHiddenWindows %Prev_DetectHiddenWindows% | |
SetTitleMatchMode %Prev_TitleMatchMode% | |
while !FileExist(A_temp "\clipjumpcom.txt") | |
sleep 50 | |
FileDelete % A_temp "\clipjumpcom.txt" | |
return 1 ;True | |
} | |
CjControl_check(){ | |
HW := A_DetectHiddenWindows , TM := A_TitleMatchMode | |
DetectHiddenWindows, On | |
SetTitleMatchMode, 2 | |
Process, Exist, Clipjump.exe | |
E := ErrorLevel , A := WinExist("\Clipjump.ahk - ahk_class AutoHotkey") | |
DetectHiddenWindows,% HW | |
SetTitleMatchMode,% TM | |
return E ? 1 : (A ? 2 : 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment