well, I was playing around with your script last night and was quite annoyed at all the add-ons that stored their settings in account wide files under the saved variables folder with separate sections for each character. So I wrote a little script in VBS (sorry didn't know how to do it in command line) that would go through and change every instance of the accountmain to the slave characters name within all of the actual files inside the savedvariables folder. Doing this with the rest of the batch wougoose wrote should pretty well synch everything.
so, incase/if anyone wants it. Here is what I did.
I added this to the ":4 echo Updating Addon Configuration..." section
Code:
C:\Scripts\SavedVariables.vbs "%gamedir1%\WTF\Account\% account1%\SavedVariables" %charmain% %char1%
C:\Scripts\SavedVariables.vbs "%gamedir2%\WTF\Account\% account2%\SavedVariables" %charmain% %char2%
C:\Scripts\SavedVariables.vbs "%gamedir3%\WTF\Account\% account3%\SavedVariables" %charmain% %char3%
C:\Scripts\SavedVariables.vbs "%gamedir4%\WTF\Account\% account4%\SavedVariables" %charmain% %char4%
And created a text filed named SavedVariables.vbs in my C:\Scripts\ folder with the following code in it. I do not know it is a bit sloppy, but hey, I am not a professional.
Code:
on error resume next
dim words(5000)
set fso = createobject("scripting.filesystemobject")
path = WScript.Arguments(0)
SearchString = WScript.Arguments(1)
ReplaceString = WScript.Arguments(2)
set parent = fso.getfolder(path)
for each file in parent.files
' FSO Constants
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateUseDefault= -2
Const TristateTrue = -1
Const TristateFalse = 0
'InStr() and Replace() constants
'Const vbBinaryCompare = 0
'Const vbTextCompare = 1
' Variables
Dim objFSO, objTS, s
sfs = ""
' Instantiate the object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' open the text file read only
Set objTS = objFSO.OpenTextFile(path &"\"& file.name, ForReading, False, TristateUseDefault)
Do While objTS.AtEndOfStream <> True
s = CStr(objTS.ReadLine())
If InStr(1, s, SearchString, vbTextCompare) <> 0 Or _
InStr(1 , s, SearchString, vbTextCompare) <> Null Then
s = Replace(s, SearchString, ReplaceString)
End If
sFS = sFS & s & vbCrLf
Loop
' Close the file after we read it in.
objTS.Close
Set objTS = Nothing
'WSCRIPT.ECHO X
' We now open the file to write it out
Set objTS = objFSO.OpenTextFile(path &"\"& file.name, ForWriting, False, TristateUseDefault)
objTS.Write sFS
objTS.Close
Set objTS = Nothing
Set objFSO = Nothing
next
Most of the script was hacked together from other scripts on the MSDN site. But there ya go. Any thoughts or comments would be very welcome.
Connect With Us