-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathGuiControl.ahk
55 lines (43 loc) · 1.55 KB
/
GuiControl.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
/* About GuiControl()
GuiControl() to update multiple controlls at once.
You can use any of the first 3 parameters to you're liking, in the same way
as in the command GuiControl. Input type is preferable a string but can be a var
, mind the double quotes.
Command:
GuiControl(, "aID", "SomeParameter") or GuiControl("Move", "aID", "x10")
Or Just Ignore the first 3 parmaters and insert a Object or Array on parameter 4.
Command:
GuiControl(,,, MyArray)
GuiControl(,,, {1: Gui1, 2: Gui2, 3: Gui3}, {1: Parm1, 2: Parm2, 3: Parm3}, {1: Parm1}, {1: Parm1, 2: Parm2})
Returns ErrorLevel.
*/
GuiControl(cmd:="", CtrlId:="", Parm:="", A*) {
SetControlDelay -1
Critical
if IsObject(A[1]) {
for i, CtrlId in A[1] {
for indx, Parm in A[i+1] {
if (A[i+1].Length() = 1) {
GuiControl, , %CtrlId%, %Parm%
E := ErrorLevel
}
else if (A[i+1].Length() = 2) {
if (indx = 1) {
cmd := Parm
}
else if (indx = 2) {
GuiControl, %cmd%, %CtrlId%, %Parm%
E := ErrorLevel
} } } } }
else if (!cmd && Parm) {
GuiControl, , %CtrlId%, %Parm%
E := ErrorLevel
} Else if (cmd && !parm) {
GuiControl, %cmd%, %CtrlId%
E := ErrorLevel
} Else if (cmd && parm) {
GuiControl, %cmd%, %CtrlId%, %P%
E := ErrorLevel
}
return E
}