-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathClass_Console Documentation
204 lines (173 loc) · 6.6 KB
/
Class_Console Documentation
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
Class:
Class_Console(Name,x,y,w,h [,GuiTitle,Timestamp,HTML,Font,Fontsize])
This creates a new console object with the name of "Name".
All the below stuff will use the console defined above.
You may use any name you like in your code.
Methods:
aaa.append([text,delim,justify,pad,colsep])
Add text to the end of the console without a timestamp.
aaa.catch([line,var,value])
Detect when a variable is a certain value or a certain line of code is executed.
aaa.clear()
Remove all the text on the console.
aaa.close()
Close the console but don't destroy it. Basically you Hide it.
aaa.color([c])
Sets text color for following lines. Default is white.
Specify "list" to see the color table.
aaa.cmd(command [,breakOn,AppendConsole])
Run (and return) a command-prompt command and get the input line-by-line.
aaa.cmdWait(command [,AppendConsole])
Run (and return) a command-prompt command and wait for it to fully finish.
aaa.destroy()
Destroy the console, it can not be shown until recreated.
aaa.debug(debugType)
Show AHK's debug info: KeyHistory, ListVars (Vars), ListLines (Lines), and ListHotkeys (Hotkeys).
aaa.eval(In [,Append])
Evaluate expression with numbers,+ # - / and *.
aaa.log([text,delim,justify,pad,colsep])
Same as append, but with a timestamp.
aaa.prepend([text,delim,justify,pad,colsep])
Same as append, but adds the text to the TOP (line 1) of the console.
aaa.pull()
Get the current console text.
aaa.save([FileName,Overwrite (flag)])
Save the console to a file.
aaa.show(GuiName)
Show a closed or recently created console.
aaa.timeSinceLastCall([id,reset])
Get the amount of time (in MS) since the last time this function was called.
aaa.update(debugType)
This is similar to doing a CLEAR and then LOG(DEBUG()).
Color Table
.-----------------.
| Name | Color |
| ----------------|
| yellow | yellow |
| orange | orange |
| white | white | <- default
| red | red |
| blue | cyan |
| lime | lime |
| green | green |
| gray | gray |
| black | black |
'-----------------'
ConsoleBar_Commands
[!ExitApp]
Desc: Exits entire script.
Syntax: ExitApp
[*Catch]
Desc: Detect when a variable is a certain value,
OR Detect when a line in ListLines exists.
Syntax: catch var varName Value command
Syntax: catch var line DebugLineNum Command
Example: catch var d 4 prepend %d%
Example: catch line 11 log line 11 was accessed!
[*Settimer]
Desc: Run a
[command] every N milliseconds (1000=1 second, 5000=5 seconds, etc).
Syntax: SetTimer N command
Example: SetTimer 1000 var Banana
[?About]
Desc: Show information about this Console and its Creators.
Syntax: About
[Append]
Desc: Add text to the end of the console.
You may use variables such as %varName%.
Syntax: Append Text
Example: Append I'm at the end of the log! For now...
[Clear]
Desc: Clear all text in the console.
Syntax: Clear
[Close]
Desc: Close (or hide) the console. It can be re-shown.
Syntax: Close
[Cmd]
Desc: Run cmd.exe commands here. You can ping, run programs, whatever you want. Output will go to the console. This gets stuff line-by-line.
Syntax: cmd cmd.exe stuff
Example: Cmd ipconfig
[CmdWait]
Desc: Run cmd.exe commands here. You can ping, run programs, whatever you want. Output will go to the console. This waits for the whole command to finish before printing to the console.
Syntax: CmdWait cmd.exe stuff
Example: CmdWait ipconfig
[Color]
Desc: Apply a color
[N] to all below lines.
Available colors: Yellow, Orange, White, Red, Blue, Lime, Green, Gray, Black.
Or type 'color list' for a visual list of all the colors.
Syntax: Color N|List
Example: color blue
Example: color list
[Debug]
Desc: Get various AHK debugging info such as Last Lines.
UNIT should be one of the following: Hotkeys, KeyHistory, Lines or Vars
Syntax: debug UNIT
Example: Debug Vars
[Destroy]
Desc: Destroy the console. It can NOT be re-shown.
Syntax: Destroy
Example: Destroy
[Log]
Desc: Add text to the end of the console with a formatted timestamp above the new text.
You may use variables such as %varName%.
Syntax: Log Text
Example: Log Some new data
[Operators]
Desc: Create and/or do math or do other unforsaken things to variables, such as append text. You do not need to use quotes around text.
Available Operators: := .= += -= *= /= //= &= ^= |=
Syntax: var+=5
Example: SomeVar.=New text at the end.
[Prepend]
Desc: Adds text to the TOP of the console, not the bottom.
You may use variables such as %varName%.
Syntax: Prepend Text
Example: Prepend I'M ON TOP OF THE WOR... CONSOLE!
[Pull]
Desc: Pulls data from console window (line/lines specifies the line numbers) and saves it in a variable (or the clipboard).
Syntax: Pull
[lines|line First-Last|N] VarName|Clipboard
Example: Pull banana
OR Pull lines 1-10 banana
OR Pull line 3 banana
[Run]
Desc: Runs a label within the script.
Syntax: Run Label
Example: Run BananaLabel -> BananaLabel: ....
[Save]
Desc: Save the console text to the specified file.
Syntax: Save Filepath
Example: Save C:\blah\log.txt
[Show]
Desc: Show a specified closed (not destroyed) console or reshow the current one.
Syntax: Show NAME
Example: Show Variable
[TimeSinceLastCall]
Desc: ID and Reset are optional. Appends time in milliseconds since the last time this command was run.
Syntax: TimeSinceLastCall ID Reset
Example: TimeSinceLastCall 1
[Update]
Desc: Uses last Debug UNIT, clearing the log and re-running the debug.
Syntax: Update
Example: Debug vars --> SetTimer 3000 Update
[Var]
Desc: Print the value of a variable to the console. no %'s needed.
-1 = Prepend, 1 = Log. Default is Append.
Syntax: Var VariableName (-1,0,1)
Example: Var Banana
----------------
<><><><><><><>
<> example: <>
<><><><><><><>
; create the console with a long time/date timestamp.
; it can now be called using "a." followed by the above method list.
a.new console("title", 100, 100, 500, 300, 1)
a.show() ; show the console we just made
a.log("Hello!") ; Print your message to it with a timestamp.
a.append("console class!") ; Add another message but with no timestamp.
sleep, 2000 ; Wait two seconds before we clear it.
a.clear() ; Clear (empty the view) console.
a.cmdWait("ipconfig") ; Show the 'ipconfig' data in your console.
sleep, 3000 ; Wait three second.
a.destroy() ; Permenantly destroy the "a." console. It'll need to be recreated for further use.
... Please view the demo files for other examples.