Skip to content

Instantly share code, notes, and snippets.

@aviaryan
Created August 24, 2013 03:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aviaryan/6325952 to your computer and use it in GitHub Desktop.
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.
;---------------------------------------
;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