vbs read range bytes, display as hex message window

January 7, 2012 at 18:29:38
Specs: Windows XP

I'd like a vbscript to read a binary file, starting from a specific location and for a specified number of bytes and output this range as hex to a message window, is this possible?

For testing purposes, we could use a text file (C:\source.txt), with a single line of text: 0123456789 , let's say I'd like 3,4 and 5 to be displayed in the message box.

PS using search, someone was interested in this 10 years ago, not sure if this approach would still work for newer versions of vbs (5.8.6001.18702)? Would you now use ADODB.Stream instead?

thank you

http://www.computing.net/answers/pr...


See More: vbs read range bytes, display as hex message window

Report •

#1
January 8, 2012 at 03:28:51
Being new to vbs, my nomenclature is somewhat muddled up, 'Message Window' should have been 'Message Box' (MsgBox)

The text file with a single line of 0123456789 in hex would be:

30 31 32 33 34 35 36 37 38 39

so in the message box, I'd like to see:

33 34 35


Report •

#2
January 8, 2012 at 04:05:47
Without going into the specifics of VB, this seems to be pretty straightforward. All you need to do is:

1. Read the file and select the appropriate bytes.

2. Convert those bytes to a hexadecimal representation and construct a string,

3. Display that string in a Message Box.

Which part of the process are you having problems with?


Report •

#3
January 8, 2012 at 04:23:34
ijack, thanks for the reply

'Which part of the process are you having problems with?' - getting an actual vbs script to work!!

Could you post an example (.vbs script) that would read c:\source.txt and output hex to a msg.box, reading from a start position, n number of bytes?

thanks


Report •

Related Solutions

#4
January 8, 2012 at 05:14:46
I'm afraid that I'm not here to write programs for people, though I'm happy to advise on difficulties. It seems that your difficulty is that you don't know how to write VBS programs.

If you want to learn VBS programming I think the answer to that is to do a little background reading and search for tutorials using Google. Then, if you have difficulties with particular aspect come back and ask.

I'm sorry if you feel that I am being harsh in not spending my time writing programs for you, but there is always the suspicion that this sort of request is an attempt to get homework done.


Report •

#5
January 8, 2012 at 06:51:28
@ijack

no problem!


Report •

Ask Question