just being a bit paranoid about the attachment getting lost so putting up an archive of the code
Code: Select all
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'EQ2 Character Remote Control Utility Version 2 take 2
'Author: tault_dice from http://www.taultunleashed.com
'email: drop me a pm at taultunleashed
'First thing this script need to do is check to see if the eq2 log file
'exsists and if it does to rename it and archive it
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Command Variables please update your character names etc here
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
installPath = "C:\Program Files\Sony\EverQuest II\logs\"
serverName = "Server Name"
characterName = "Slave_Name"
masterName = "Master_Name"
commandPhrase = "command phrase here"
commandDelimiter = "$"
exitScript = "exit script phrase here"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'File Const declarations
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Creation of the date entry
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dtmThisDay = Day(Date)
dtmThisMonth = Month(Date)
dtmThisYear = Year(Date)
dtmThisHour = Hour(Time)
dtmThisMinute = Minute(Time)
dtmThisSecond = Second(Time)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Creating the timestamp for the log file
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strBackupName = dtmThisYear & "-" & dtmThisMonth & "-" & dtmThisDay & "-" _
& dtmThisHour & dtmThisMinute & dtmThisSecond
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Accessing the FileSystemObject and the WshShell
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim objFSO, WshShell, logFile, currentLine
Set objFSO = CreateObject("Scripting.FileSystemObject")
set WshShell = WScript.CreateObject("WScript.Shell")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'checking to see if the log file exists and if it exists it will rename the
'origional log file to log<timestamp>.txt
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
logFilePath = installPath & serverName & "\eq2log_" & characterName & ".txt"
logFileRenamePath = installPath & serverName & "\eq2log_" & characterName & "-" & strBackupName & ".txt"
If objFSO.FileExists(logFilePath) Then
objFSO.MoveFile logFilePath , logFileRenamePath
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Open the new log file as a text stream
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
WScript.echo logFilePath 'Error Check the path name to the logfile
if NOT objFSO.FileExists (logFilePath) THEN
set logFile = objFSO.CreateTextFile (logFilePath, forWriting)
logFile.close
End If
set logFile = objFSO.OpenTextFile (logFilePath, forReading)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Here we start to loop the script to read from the logfile and then act on
'the commands issues via tell
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'scriptInAction is the control vairiable for the do util loop while
'scriptInAction is 1 the do loop continues
'either exit do or set scriptInAction to another number to end
'the script's loop
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dim scriptInAction
scriptInAction = 1
currentLine = "0"
Do While scriptInAction = 1
If logFile.AtEndOfStream <> True Then
currentLine = logFile.ReadLine
If InStr (currentLine, exitScript)
scriptInAction = 0
End If
If InStr (currentLine, masterName) And InStr (currentLine, commandPhrase)
workingLine = StrReverse (currentLine)
workingLine2 = Split (workingLine, commandDelimiter, 1, 1)
workingLine = StrReverse (workingLine2)
WshShell.SendKeys ("/" & workingLine & "~")
End If
End If
WScript.echo currentLine
WScript.Sleep 50
currentLine = "holding"
Loop
WScript.echo "Complete"
logFile.Close