Hi Guys! I wanted to read a Log-File using VBScript, but he reads 4 Symbols only all the time. If I copy the text inside the Logfile, its 16KB so the Logfile must be a special .txt file? How to change that?
I'm not sure, if I understand you - but could it be that you log file is encoded in Unicode? In that case, use the 4th parameter (format) of the OpenTextFile methode to read the file as Unicode.
Es geht um eine Log-Datei, die immer 32KB groß ist. Wenn ich sie normal öffne liest vb 4 seltsame Symbole und dann nichts mehr. Wenn ich den Inhalt in eine andere Datei kopieren ist diese nur 16 KB groß, und er kann es lesen... Auf einem anderen Rechner ist das kopierte aber auch wieder 32KB... Schwer zu erklären, ist halt alles ein bisschen verworren... Falls du Text-analytische Fähigkeiten hast kannst du vll verstehen was ich meine ;)
______________ ___________________________ _____________________________________ _________________ Datei immer 32 KB -> Inhalt in anderer txt = 16 kb -> Auf anderem Rechner ist der Inhalt auch 32KB -> Unicode geht nicht ______________ ___________________________ _____________________________________ _________________
< Message edited by Sirect -- 6/15/2008 10:44:09 PM >
please stick to English (except in emergencies). Could you specify the type/kind of log file you are trying to read? In my opinion, the 32/16 = 2/1 ratio still indicates a problem caused by reading a Unicode text file in a non-Unicode mode. But maybe the the file is binary?
You said you copied the file. How? What software tool did you use?
So all my philological efforts result in more questions ...
Hi! I opened the file in a text editor and highlighted the content. After that I saved the content to a new .txt file. My Problem is, that the same procedure results in an other way on another machine. There, the new .txt is also 32KB. I already tried to read it using unicode, but he is only able to read the same 4 symbols... May I have to open it in a Hex-Editor to see whether it contains Control-Commands? (Steuerbefehle)
yes, use a hex editor to get more info about the file. But can't you just identify the creator of this file? Is it a secret? Could you email a (short) sample to my address?
If you could read the content in a text editor (which one?), the chances are good that it isn't binary. Then reading it using something like this:
Const ForReading = 1 Const TristateTrue = -1
Dim sFSpec : sFSpec = "unicode.reg" ' <--- your logfile Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" ) Dim sText : sText = oFS.OpenTextFile( sFSpec, ForReading, False, TristateTrue ).ReadAll
I used the same code for my first try, but it is not working... "no two matches"... The Editor I used was the normal one, which is included in Windows (Not Notepad). Im going to get a Hex-Editor now...
Okay, I opened the File and It starts with "FFFE22" (Translate from Hex to Ascii and you will see my Symbols :P ) The rest seems to be normal, but after deleting FFFE22 the script could not read the file either. BTW: The Log is written by a Sheduler, which will start to overwrite the file, if it has reached 32KB...