-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuickLook.ahk
128 lines (118 loc) · 2.53 KB
/
QuickLook.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
#SingleInstance, Force
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#NoTrayIcon
FileInstall, C:\Users\michaelanthony\Pictures\TooBig.png, %A_appdata%\TooBig.png
SetBatchLines, -1
ListLines, Off
spaceOpen = 0
imgExt = jpg,jpeg,png,tiff,tif
;txtExt = txt,text,ahk,rtf,doc
#If ActiveDir()
Space::ImageSplash()
#If (ActiveDir() && spaceOpen = 1)
Up Up::
Send {Up}
spaceOpen=0
ImageSplash()
Return
#If (ActiveDir() && spaceOpen = 1)
Down Up::
Send {Down}
spaceOpen=0
ImageSplash()
Return
#If (ActiveDir() && spaceOpen = 1)
Left Up::
Send {Left}
spaceOpen=0
ImageSplash()
Return
#If (ActiveDir() && spaceOpen = 1)
Right Up::
Send {Right}
spaceOpen=0
ImageSplash()
Return
#If
gst(ByRef Type = "") {
IsClipEmpty := (Clipboard = "") ? 1 : 0
if (!IsClipEmpty) {
ClipboardBackup := ClipboardAll
While !(Clipboard = "") {
Clipboard := ""
Sleep, 10
}
}
Send, ^c
ClipWait, 0.1
Type := fileInClip()
clipValue := Clipboard
Clipboard := ClipboardBackup
if (!IsClipEmpty)
ClipWait, 0.5, 1
Return clipValue
}
ActiveDir() {
WinGetActiveTitle, title
WinGetText, text, % title
WinGetClass, class, % title
if InStr(text, "Address")
{
StringSplit, Dir, Text, `n, %A_Space%
Dir := SubStr(Dir1, 10, -1) ; Remove the "Adress:" and a space from the end.
}
else if (class = "Progman") or (class = "") ; If mouse is over desktop
Dir := A_Desktop
Return Dir
}
fileInClip() { ; Checks to see if the clipboard contains a file.
Return % ((DllCall("IsClipboardFormatAvailable", "uint", 15) && InStr(Clipboard, ".")) ? "File" : "")
}
ImageSplash() {
global
if (spaceOpen = 1)
{
SplashImage, Off
spaceOpen = 0
}
else
{
clipValue := gst(type) ; Gets the clipboard and determines if it contains a file.
SplitPath, clipValue,,,clipExt
if (type != "File"){
Send, %A_Space%
SplashImage, Off
spaceOpen = 0
}
Else if clipExt in %imgExt%
{
FileGetSize, vCheck,%clipValue%,M
if (vCheck < 20)
{
guinum = 99
gui, %guinum%:add,picture,vmypic,%clipValue%
GuiControlGet, mypic, %guinum%:Pos
gui, %guinum%:destroy
if (mypicH > 1080 || mypicW > 1920)
SplashImage, %clipValue%,B ZH1000 ZW-1,%A_Space%,%A_Space%
else
SplashImage, %clipValue%,B,%A_Space%,%A_Space%
spaceOpen = 1
}
else
{
Send, %A_Space%
SplashImage, %A_appdata%\TooBig.png,B,%A_Space%,%A_Space%
spaceOpen = 1
}
}
Else
{
Send, %A_Space%
SplashImage, Off
spaceOpen = 0
}
}
}