-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathSnapFolderWindows.ahk
69 lines (54 loc) · 1.62 KB
/
SnapFolderWindows.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
SnapFolderWindows(fnFolderNamesList,fnWhichSide := "R")
{
; function description
; MsgBox fnFolderNamesList: %fnFolderNamesList%`nfnWhichSide %fnWhichSide%
; declare local, global, static variables
Try
{
; set default return value
ReturnValue := 0 ; success
; validate parameters
If !fnFolderNamesList
Throw, Exception("fnFolderNamesList was empty")
If fnWhichSide not in L,R
Throw, Exception("Invalid value for fnWhichSide")
; initialise variables
; do something
WinGet, SourceControlFoldersList, List, ahk_class CabinetWClass
Loop, %SourceControlFoldersList%
{
ThisWinId := SourceControlFoldersList%A_Index%
WinGetTitle, ThisWinTitle, ahk_id %ThisWinId%
If ThisWinTitle contains %fnFolderNamesList%
{
WinGetPos, ThisWinX, ThisWinY, ThisWinW, ThisWinH, ahk_id %ThisWinId%
If (ThisWinX != 1913 || ThisWinY != 0 || ThisWinW != 654 || ThisWinH != 970)
{
WinActivate, ahk_id %ThisWinId%
WinWaitActive, ahk_id %ThisWinId%
If (fnWhichSide = "L")
Send #{Left}
Else
Send #{Right}
Sleep, 100 ;slight pause for move to complete
; WinSet, Bottom,, ahk_id %ThisWinId%
}
}
}
}
Catch, ThrownValue
{
ReturnValue := !ReturnValue
CatchHandler(A_ThisFunc,ThrownValue.Message,ThrownValue.What,ThrownValue.Extra,ThrownValue.File,ThrownValue.Line,0,0,0)
}
Finally
{
}
; return
Return ReturnValue
}
; /* ; testing
FolderNamesList := "Stored Procedures,Functions,Programmability,Stored Procedures,Synonyms,Tables,User Defined Types,Views"
ReturnValue := SnapFolderWindows(FolderNamesList)
MsgBox, SnapFolderWindows`n`nReturnValue: %ReturnValue%
*/