forked from DarthBrento/MouseKeysPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsolelog.ahk
75 lines (59 loc) · 1.52 KB
/
consolelog.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
72
73
74
75
;CONSOLE CONTROLS
; based on a script from the ahkscript.org forums
Cadd(text, exception := "", lineNumber := "")
{
global
FormatTime, NowStamp, %A_now%, HH:mm:ss
if (lineNumber != "")
text := lineNumber . " " . text
text := NowStamp . " " . text
if (exception != "")
{
text := text . " !Exception! `n" . A_Tab . "what: " exception.what "`n" . A_Tab . "file: " exception.file . "`n" . A_Tab . "line: " exception.line "`n" . A_Tab . "message: " exception.message "`n" . A_Tab . "extra: " exception.extra
}
Ctext := text . "`n" . Ctext ;newest lines on top of course
GuiControl,consoleLog:, Ctext, %Ctext%
}
Cclear()
{
global
FormatTime, NowStamp, %A_now%, HH:mm:ss
Ctext := "## " . NowStamp . " - CLEAR"
GuiControl,, Ctext, %Ctext%
}
Cexport(filename = 0)
{
Global Ctext
If !filename
{
filename := a_scriptdir . "\ConsoleExport" . A_now . ".txt"
}
FileAppend, %Ctext%, %filename%
Run, Notepad.exe %filename%
Return
}
Cfile(file,text)
{
filename := a_scriptdir . "\" . file
FileAppend, %text%, %filename%
Return
}
Cinit()
{
global
;; LOG CONSOLE GUI
Gui, consoleLog:Add, Edit, w400 h200 vCtext hScroll, %Ctext%
Gui, consoleLog:Add, Button, gCexport y+5 x+-200, EXPORT
Gui, consoleLog:Add, Button, gCclear yp+0 x+-150, CLEAR
Gui, consoleLog:show, AutoSize x0 y0
}
Cdestroy()
{
Gui, consoleLog:destroy
}
Cexport:
Cexport()
return
Cclear:
Cclear()
return