-
Notifications
You must be signed in to change notification settings - Fork 1
/
gui.ahk
71 lines (59 loc) · 1.57 KB
/
gui.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
;Autoexec:
#Include %A_ScriptDir%\lib.ahk
global vScriptName
global vWorkingDir
Gui, Font, s10,
Gui, Add, Text, Section, Select directory:
Gui, Add, Button, gDir , ...
Gui, Add, Text, w320 r2 vCDir, No directory is selected...
Gui, Add, Text, ys Section, Select script:
Gui, Add, DropDownList, gRunScript w280, template|files|
Gui, Add, Button, gRun, Run
Gui, Add, Edit, xm Section w620 h380 vLog
Gui, Show, w640 h480, Script Logger
GuiControl, Focus, Close
Return
Dir:
FileSelectFolder, vWorkingDir, , 3
if vWorkingDir =
MsgBox, No directory was selected...
else {
GuiControlGet, CDir
GuiControl, , CDir, %vWorkingDir%
}
Return
RunScript:
vScriptName := A_GuiControl
Return
Run:
Runner()
Return
GuiEscape:
GuiClose:
Gui, Destroy
ExitApp
Return
Runner() {
global vWorkingDir
if vScriptName {
Gui, 1:+Disabled
ClearLogger()
Logger("[ " . Timer() . " ]" . " script """ . vScriptName . """ running...`n")
RunWait autohk %A_ScriptDir%\%vScriptName%.ahk %vWorkingDir%
FileRead, Contents, %vWorkingDir%\%vScriptName%.log
Logger(Contents)
time := Timer()
Logger("[ " . Timer() . " ]" . " script """ . vScriptName . """ finished`n")
Gui, 1:-Disabled
}
else
MsgBox Choose script to run
}
Logger(msg) {
GuiControlGet, Log
GuiControl, , Log, %Log%%msg%`n
}
ClearLogger() {
GuiControlGet, Log
GuiControl, , Log,
}