Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CountLines() {
- LogFilePath := A_AppData "\.minecraft\logs\latest.log" ;---- Counts how many lines there and, used to read the very last and therefor, most recent line in Chat.
- Loop, Read, %LogFilePath%
- lineCount++
- return lineCount
- }
- ReadChat() {
- LogFilePath := A_AppData "\.minecraft\logs\latest.log"
- Num := CountLines()
- FileReadLine, ChatMessage, %LogFilePath%, %Num% ;--- Reads last line in Minecraft's latest.log file
- if InStr(ChatMessage, "[CHAT]") {
- ChatMessage := RegExReplace(ChatMessage, ".*: \[CHAT\] ", "") ;--- Cuts out all the unnecessary info
- ChatMessage := RegExReplace(ChatMessage, "§[0-9a-fr]", "")
- }
- return ChatMessage
- }
Advertisement
Add Comment
Please, Sign In to add comment