Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


32 KB Log-File

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61384
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> 32 KB Log-File
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 32 KB Log-File - 6/15/2008 7:34:28 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
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?

Sirect
 
 
Post #: 1
 
 RE: 32 KB Log-File - 6/15/2008 9:03:37 PM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

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.

Good luck!

ehvbs

(in reply to Sirect)
 
 
Post #: 2
 
 RE: 32 KB Log-File - 6/15/2008 10:43:03 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Jetzt nochmal auf Deutsch:

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 >

(in reply to Sirect)
 
 
Post #: 3
 
 RE: 32 KB Log-File - 6/16/2008 4:50:11 AM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

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 ...

ehvbs

(in reply to Sirect)
 
 
Post #: 4
 
 RE: 32 KB Log-File - 6/16/2008 5:27:22 AM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
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)

Sirect

(in reply to ehvbs)
 
 
Post #: 5
 
 RE: 32 KB Log-File - 6/16/2008 5:39:49 AM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

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

should work.

How about giving unicode another try?

Regards

ehvbs

(in reply to Sirect)
 
 
Post #: 6
 
 RE: 32 KB Log-File - 6/16/2008 5:52:27 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
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...

Will read 'ya later!

Sirect

(in reply to ehvbs)
 
 
Post #: 7
 
 RE: 32 KB Log-File - 6/16/2008 6:02:14 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
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...

(in reply to Sirect)
 
 
Post #: 8
 
 RE: 32 KB Log-File - 6/16/2008 7:43:08 PM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

Theory: "FFFE" is the Unicode BOM - http://de.wikipedia.org/wiki/Byte_Order_Mark

Practice:


      

Output:


      

QED.

ehvbs

(in reply to Sirect)
 
 
Post #: 9
 
 RE: 32 KB Log-File - 6/16/2008 10:11:00 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Its working with the StreamRead...
Seems to be Unicode...


Sirect


btw: Help me in the other Thread putting in the Streamreader!

(Please )

(in reply to ehvbs)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> 32 KB Log-File Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts