forked from valleyman86/AutoRecordGO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoRecordGO.ahk
89 lines (75 loc) · 1.99 KB
/
AutoRecordGO.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;Created By valleyman86
; needs to be #Persistent, otherwise events will kick few times and script exits.
#Persistent
PlayerName := "MurderDev\.com"
ConsolePath := "C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Global Offensive\csgo\console.log"
AutoTrim, On
;Delete this section to remove auto recording
;-start-
SetTimer MonitorConsoleLog, 500
EraseConsoleLog(ConsolePath)
File := FileOpen(ConsolePath, "r")
;File := FileOpen("D:\test.txt", "rw")
File.Seek(0, 2)
Size0 := File.Length
gMapName := ""
;-end-
;Delete this section to remove Ctrl+Shift+S hotkey recording
;-start-
#If WinActive("ahk_exe csgo.exe")
^+s::
RecordDemo()
return
#if
;-end-
;Delete this section to enable caps lock in game. (Note: It still works as a key it just does not stay toggled on)
;-start-
#If WinActive("ahk_exe csgo.exe") or WinActive("ahk_exe dota.exe")
~CapsLock Up::SetCapsLockState, off
#if
;-end-
RecordDemo()
{
FormatTime, time, %A_Now%, MM-dd-yy_hh-mmtt
SendInput ``
Sleep, 250
SendInput record Saved_Demos\%gMapName%%time% {enter}
Sleep, 100
SendInput ``
}
EraseConsoleLog(filePath)
{
FileToErase := FileOpen(filePath, "w")
FileToErase.Write("")
FileToErase.Close()
}
MonitorConsoleLog:
global gMapName
Size := File.Length
If (Size0 >= Size) {
Size0 := Size
File.Seek(0, 2)
Return
}
;LastLine := File.ReadLine()
while (LastLine := File.ReadLine()) {
if (RegExMatch(LastLine,"i)^Map: (.*/)?(.*)", MapName)) {
;MsgBox %MapName2%
gMapName := MapName2 . "_"
}
if (RegExMatch(LastLine,"i)" . PlayerName . " connected")) {
Sleep, 6000
RecordDemo()
;MsgBox %LastLine%
}
if (RegExMatch(LastLine,"i)Recording to")) {
SoundBeep
;SoundPlay recording_started.mp3
}
if (RegExMatch(LastLine,"i)Completed demo")) {
SoundBeep
;SoundPlay replay_saved.mp3
}
}
Size0 := Size
Return