forked from aviaryan/Clipjump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClipjumpCommunicator.ahk
90 lines (73 loc) · 2.75 KB
/
ClipjumpCommunicator.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Clipjump Communicator v4
---------------------
Use this function to momentarily disable/enable Clipjump's "Clipboard monitoring" .
#####################
HOW TO USE
#####################
To DISABLE the selected of the following functions , sum their codes and send in the function -
Clipboard Monitoring - 2
Paste Mode - 4
Copy file path - 8
Copy folder path - 16
Copy file data - 32
Clipbord History Shortcut - 64
Select Channel - 128
One Time Stop shortcut - 256
DISABLE ALL = Use a single code '1048576'
ENABLE ALL = Use a single code '1'
#####################
NOTES
SEE EXAMPLE
Make sure Clipjump is named as "Clipjump" (Case-Sensitive) both in exe or in ahk form
#####################
Example
To disable , Clipboard Monitoring and Copy file path shortcut, you use
CjControl(2+8) = CjControl(10)
Now to enable Copy file path shortcut but keep disabled the Clipboard Monitoring, use
CjControl(1) - enable all functionalities
CjControl(2) - disable Clipboard monitoring
*/
;###########################################################################################
;FUNCTION (See HOW TO USE above)
;###########################################################################################
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=1 ? ".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
if A_index>100
return -1 ;Timeout..
}
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
A := WinExist("\Clipjump.ahk - ahk_class AutoHotkey")
E := WinExist("\Clipjump.exe - ahk_class AutoHotkey")
DetectHiddenWindows,% HW
SetTitleMatchMode,% TM
return A ? 1 : (E ? 2 : 0)
}