aboutsummaryrefslogtreecommitdiff
path: root/tt.jump.ahk
blob: f1e62c1526a5ed23a54473421efd384500c04e39 (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
;; -> 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" }

;; -> body

; Open in new Explorer window

#s::
ToolTip, ...
Input, k, M C L1
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 """"
}