-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnipper.ahk
86 lines (71 loc) · 1.6 KB
/
Snipper.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
#SingleInstance Force
global MyMenu
global BaseFolder := A_ScriptDir . "\Snippets"
global extensions := ["txt"]
#Include includes\customTray.ahk
#Include includes\FolderStructure.ahk
Tray := A_TrayMenu
Tray.Add() ; Creates a separator line.
for k,v in ["CTRL x2`tShow Menu",
"Click File`tPaste Content",
"CTRL Click`tEdit File",
"SHIFT Click`tAppend to file"]
{
Tray.Add(v, DoNothing)
Tray.SetIcon(v, "icons\hotkey.ico")
tray.Disable(v)
}
Tray.Add()
SetupTray()
;-----------------------
;Listen to hotkeys if vbeditor is active window
;-----------------------
; #HotIf WinActive("ahk_class wndclass_desked_gsk")
;-----------------------
;Long press right button
;-----------------------
; RButton::
; {
; startTime := A_TickCount
; KeyWait("RButton", "U")
; keypressDuration := A_TickCount-startTime
; if (keypressDuration > 200)
; {
; Main()
; }
; else
; {
; Send("{RButton}")
; }
; }
;-----------------------
;Double press ctrl
;-----------------------
~Ctrl Up::
{
If A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 400
Main()
}
Main(){
global
try
myMenu.Delete
myMenu:= Menu()
AddFolderStructureToMenu(MyMenu, BaseFolder, extensions, "theHandlerFunction")
myMenu.Show()
}
theHandlerFunction(filePath, *) {
if GetKeyState("Ctrl"){
Run 'edit ' filePath
}else if GetKeyState("Shift"){
Send("{Ctrl down}c{Ctrl up}")
Sleep(100)
text := "`n" A_Clipboard
FileAppend(text, filePath)
}else{
text := FileRead(filePath)
A_Clipboard := text
Sleep(100)
Send("{Ctrl down}v{Ctrl up}")
}
}