PDA

View Full Version : EQ Log Organizer


myxomatosii
04-05-2014, 08:41 AM
I wrote a log organizer.. to explain.

1 - Put it in location of log files.
2 - Run it (After compiling it)
3 - Reads specified log file searching for a keyword
4 - Writes every line containing keyword to a new log file
5 - Tada, new log file with only "guild" chat!

(Replace "guild" with any keyword you want)

Anyway, here is the source, I ain't posting no .exe. Compile it yourself if interested, that's the only safe way.

Also, open to criticism from *actual* coders, I'm self-taught so it could be terribly done, no clue.

https://drive.google.com/file/d/0B9DA8aK6VR8hMXloZXJGSHpzSE0/edit?usp=sharing

I use Scite4AutoIt3 to edit, it will also compile it, first download on page

http://www.autoitscript.com/site/autoit-script-editor/downloads/

;goal - chat log reader/writer v0.1

#include <File.au3>

;press esc to end the program, change this to w/e you like?
HotKeySet("{esc}","kill")

;assures the program looks for your logs where its located
FileChangeDir(@ScriptDir&"\")
msgbox(0,"Warning!","This does NOTHING to your files, but before clicking continue please make a copy of your 'EverQuest\Logs' folder and run this there. Better safe than sorry and I'd hate being blamed for ruining your logs!",0)
msgbox(0,"Warning!","If this program is not running from your 'EverQuest\Logs' folder, please press ESC now and move it! Press ESC at any time to kill this program! Finally, only run this when the log you are trying to scan is not in use! ie: Don't scan Coeur's log files if you are logged into Coeur!",0)

;collects log character name, word to search for, and gives the file a unique name so no past created logs are overwritten
$name=string(InputBox("Character Selection","Enter the character name of the log files we will be reading: [Case sensitive]","Coeur"))
$keyword=string(InputBox("Search Term","What word are we looking for?","guild"))
$reason=string(InputBox("Category","Name your output file!: [Optional]",$keyword&@year&"_"&@mon&"_"&@mday&"@"&@hour&@min))

;starts on the first line
$line=1

;variables to make the progress bar work
$latestPercent=0
$percent=1

;points to location of logs based on location of script (SHOULD BE IN SAME FOLDER)
$logPathName=String(@ScriptDir&"\eqlog_"&$name&"_project1999.txt")
$totalLines=_FileCountLines($logPathName);final line

;states the total number of lines to be scanned
msgbox(0,"","Counted "&$totalLines&" in "&$logPathName&", press OK to continue.",0)

;location and properties of progress bar
ProgressOn("Stembolt's Log Reader", "Press ESC to quit", "Reading all your secrets..",@desktopwidth/2-100,@desktopheight/2-50,18)

;main loop, for $line=1 to final line as counted by _FileCountLines
For $percent = 0 To 100
;reads a line
$text=string(FileReadLine("eqlog_"&$name&"_project1999.txt",$line))

;found returns a 0 if the keyword is not found in text
$found=StringInStr($text,$keyword,0,1,1,200);if the search term is found in the first 200 chars then variable $found<>0

;if found is nonzero, the text was found
if $found <> 0 then
;writes the line with the keyword to the new log
FileWriteLine($name&"_"&$reason&".txt",$text)
EndIf
;progressbar code, increments in 1% intervals
if $percent > $latestPercent+1 then
ProgressSet($percent)
$latestPercent=$percent
EndIf
$percent=$line/$totalLines*100

;prepares for next line
$line=$line+1

;loops back to For
Next

;displays completion
ProgressSet(100, "Done!")

;beeps a completion tone, 300Hz for 300ms
beep(300,300)
beep(400,300)
sleep(5000)
ProgressOff()

;if you press ESC, checks to avoid accidental keypresses then exits
func kill()
$id=msgbox(4,"Quit?","Do you wish to EXIT Stembolt's EQ Logger? Its ok, I'll understand :(",0)
If $id=7 Then;no
Sleep(100)
ElseIf $id=6 then;yes
;beeps a completion tone, 300Hz for 300ms
beep(300,300)
beep(200,300)
Exit
EndIf
endfunc