aboutsummaryrefslogtreecommitdiff
path: root/tt.jump.ahk
blob: b5c0f5abf8eaef46c64cb26a4da081e19a071187 (plain)
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
;; -> init

JumpPaths := { s: env("Sync")
	, w: env("Sync") "\Projekt\john.ankarstrom.se\htdocs"
	, g: env("Sync") "\Projekt\git"
	, u: env("UserProfile")
	, e: env("UserProfile") "\Documents"
	, d: env("UserProfile") "\Downloads"
	, m: env("UserProfile") "\Music"
	, p: env("UserProfile") "\Pictures" }

DisableHotkeys := false

;; -> body

#If !DisableHotkeys
#e::OpenExplorer("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
#If

#s::
ToolTip, ...
DisableHotkeys := true
Input, k, M C L1
DisableHotkeys := false
if (JumpPaths[k] != "")
{
	if (InStr(FileExist(JumpPaths[k]), "D"))
		OpenExplorer(JumpPaths[k])
	else
		Run, % """" JumpPaths[k] """"
}
ToolTip
return

;; -> library

env(name)
{
	EnvGet, r, %name%
	return r
}

OpenExplorer(path)
{
	for window in ComObjCreate("Shell.Application").Windows {
		if (window.Document.Folder.Self.path = path) {
			WinActivate, % "ahk_id " window.hwnd
			return
		}
	}
	Run, % "explorer /n, """ path """"
}