1.

Solve : Remake a config file?

Answer»

Sorry for the weak subject. I didn't come up with a better one since English isn't my spoken language
I have a config file that i have to remake some. The file name is PROF_SAVE_profile with no file extension and looks like this

Code: [Select]GstAudio.AudioQuality 1GstAudio.CarRadio 0GstAudio.DialogueVolume 0.700000GstAudio.MusicVolume 0.700000GstAudio.SoundSystemSize 20GstAudio.StereoMode 1GstAudio.VOLanguage 0GstAudio.Volume 1.000000GstAudio.YourSoundSystem 2GstRender.AmbientOcclusion 0GstRender.AnisotropicFilter 2GstRender.AntiAliasingDeferred 0GstRender.AntiAliasingPost 0GstRender.Brightness 0.779070GstRender.Contrast 0.500000GstRender.EffectsQuality 1GstRender.Enlighten 1GstRender.FieldOfView 80.000000GstRender.FullscreenEnabled 1
What i want is to have a new line after every sentence that starts with Gst so it looks like this instead.

Code: [Select]GstAudio.AudioQuality 1
GstAudio.CarRadio 0
GstAudio.DialogueVolume 0.700000
GstAudio.MusicVolume 0.700000
GstAudio.SoundSystemSize 20
GstAudio.StereoMode 1
GstAudio.VOLanguage 0
GstAudio.Volume 1.000000
GstAudio.YourSoundSystem 2
GstRender.AmbientOcclusion 0
GstRender.AnisotropicFilter 2
GstRender.AntiAliasingDeferred 0
GstRender.AntiAliasingPost 0
GstRender.Brightness 0.779070
GstRender.Contrast 0.500000
GstRender.EffectsQuality 1
GstRender.Enlighten 1
GstRender.FieldOfView 80.000000
GstRender.FullscreenEnabled 1

Yes i could do everything manually but the file is huge and it would take some time to do that Quote from: Apexi on November 25, 2011, 03:02:56 AM

Code: [Select]GstAudio.AudioQuality 1GstAudio.CarRadio 0GstAudio.DialogueVolume 0.700000GstAudio.MusicVolume 0.700000GstAudio.SoundSystemSize 20GstAudio.StereoMode 1GstAudio.VOLanguage 0GstAudio.Volume 1.000000GstAudio.YourSoundSystem 2GstRender.AmbientOcclusion 0GstRender.AnisotropicFilter 2GstRender.AntiAliasingDeferred 0GstRender.AntiAliasingPost 0GstRender.Brightness 0.779070GstRender.Contrast 0.500000GstRender.EffectsQuality 1GstRender.Enlighten 1GstRender.FieldOfView 80.000000GstRender.FullscreenEnabled 1

Is this all on one single line?
If this is a 1-off job, then use an editor
replace
Gst
with
{cr}Gst

where {cr} is a lineend Quote from: Salmon TROUT on November 25, 2011, 03:07:38 AM
Is this all on one single line?

Hmm it's like 60 lines totaly. Quote from: Apexi on November 25, 2011, 03:19:36 AM
Yes, exactly as i posted in the first code tag.

hard to tell because it is wrapped
Quote from: Salmon Trout on November 25, 2011, 03:20:59 AM
hard to tell because it is wrapped

Sorry my missunderstanding. I edited my post.please post whole of the file you wish to convert. Is it 1 line or 60 lines?
Lol that was easy. Just opended up the file with MS Office and it manage to break the lines right.

But still to learn something new i want to know how to make the batch file. But i cant paste the whole config since would fill up the entire site, as i said, it's huge.
To explain the problem in details. I want a linebreak before every "Gst"Hard to do in batch, easy to do in VBscript.

Set oFSO = CreateObject("Scripting.FileSystemObject")
sFile = wscript.arguments(0)
sdelm = wscript.arguments(1)
Set oFile = oFSO.OpenTextFile(sFile, 1)
sMyString = oFile.ReadLine
oFile.Close
aSplitstring=Split(sMyString, sDelm, -1, 1)
For j = 1 To UBound(aSplitstring)
   wscript.echo sDelm & aSplitstring(j)
Next

Save script as (for example) convert.vbs

This is PROF_SAVE_profile

GstAudio.AudioQuality 1GstAudio.CarRadio 0GstAudio.DialogueVolume 0.700000GstAudio.MusicVolume 0.700000GstAudio.SoundSystemSize 20GstAudio.StereoMode 1GstAudio.VOLanguage 0GstAudio.Volume 1.000000GstAudio.YourSoundSystem 2GstRender.AmbientOcclusion 0GstRender.AnisotropicFilter 2GstRender.AntiAliasingDeferred 0GstRender.AntiAliasingPost 0GstRender.Brightness 0.779070GstRender.Contrast 0.500000GstRender.EffectsQuality 1GstRender.Enlighten 1GstRender.FieldOfView 80.000000GstRender.FullscreenEnabled 1

at the command line, or in a batch:

cscript //nologo convert.vbs "PROF_SAVE_profile" "Gst" > "PROF_SAVE_profile.new"

This is PROF_SAVE_profile.new

GstAudio.AudioQuality 1
GstAudio.CarRadio 0
GstAudio.DialogueVolume 0.700000
GstAudio.MusicVolume 0.700000
GstAudio.SoundSystemSize 20
GstAudio.StereoMode 1
GstAudio.VOLanguage 0
GstAudio.Volume 1.000000
GstAudio.YourSoundSystem 2
GstRender.AmbientOcclusion 0
GstRender.AnisotropicFilter 2
GstRender.AntiAliasingDeferred 0
GstRender.AntiAliasingPost 0
GstRender.Brightness 0.779070
GstRender.Contrast 0.500000
GstRender.EffectsQuality 1
GstRender.Enlighten 1
GstRender.FieldOfView 80.000000
GstRender.FullscreenEnabled 1

How long before the "After I've made edits, how do I join them all back together?" question... ?
Quote from: Salmon Trout on November 25, 2011, 04:37:40 AM
How long before the "After I've made edits, how do I join them all back together?" question... ?

Sorry dont understand what you are meaning, but thanks for the explanation on the script.
I've never try VBscript before so it's just funny to learn something new.

Cheers Quote from: Apexi on November 25, 2011, 08:23:13 AM
Sorry dont understand what you are meaning

The game REQUIRES this

Code: [Select]GstAudio.AudioQuality 1GstAudio.CarRadio 0GstAudio.DialogueVolume 0.700000GstAudio.MusicVolume 0.700000GstAudio.SoundSystemSize 20...
You wanted to GET this

Code: [Select]GstAudio.AudioQuality 1GstAudio.CarRadio 0
GstAudio.DialogueVolume 0.700000
GstAudio.MusicVolume 0.700000
GstAudio.SoundSystemSize 20
...

Why? What is it for? The game cannot read the new format, can it? I thought you might want to edit the VALUES.
Quote from: Salmon Trout
Why? What is it for? The game cannot read the new format, can it? I thought you might want to edit the values.

Ah now i undestand. It belongs to Battlefield 3, and as usally i always check the config file on all games a play since some developer doesn't show all options under settings ingame.
This way make it just easier to read and change. Later on when you start up the game it automatically change back to the old layout, but the settings you change remains.I don't know what editor or viewing method you you are using where you see all the entries mashed up against each other; they should be one to a line I think (see link below, scroll down for raw data) have you tried Wordpad?

http://pastebin.com/jKGBnbPq







Discussion

No Comment Found