I've been browsing and I can't seem to find a good way in
vbs to convert a hex to a string. I see a hex() function
that takes a string but I don't see a toString() that
takes a hex vaule.

Can anybody point me to a usefull resource? I'd be more
than happy to work with a conversion table...

thanks, and you guys are great!
-Jess

Re: Hex to String??? by Alex

Alex
Mon Dec 01 15:33:16 CST 2003

JesseH wrote:
> I've been browsing and I can't seem to find a good way in
> vbs to convert a hex to a string. I see a hex() function
> that takes a string but I don't see a toString() that
> takes a hex vaule.
>
> Can anybody point me to a usefull resource? I'd be more
> than happy to work with a conversion table...
>
> thanks, and you guys are great!
> -Jess

Jess, the hex() function actually takes a number and converts it to a string
hexadecimal representation; in memory, a hex value is just another number.
So the number 47 when transformed with Hex() yields the string 2F.

What are you after, actually? It sounds like you want to take an actual hex
string representation of a number and do something else to it, but I'm not
sure what. If you want to take a Hex string and turn it into an actual
number again, you would prepend "&H" to it and convert it to a long...

newNum = CLng( "&H" & myHexString )



Re: Hex to String??? by JesseH

JesseH
Mon Dec 01 15:50:41 CST 2003

>What are you after, actually? It sounds like you want
to take an actual hex
>string representation of a number and do something else
to it, but I'm not
>sure what. If you want to take a Hex string and turn it
into an actual
>number again, you would prepend "&H" to it and convert
it to a long...
>
>newNum = CLng( "&H" & myHexString )


Here is what I have:
Socket send:[10][0C][00]
Socket recv:[10][0C][2C][F0][54][39][39][31][32][47][53]
[43][33][34][39][33][20][20][20][20][20][20][20][20][20]
[20][20][20][20][20][20][20][20][20][31][30][30][30][30]
[35][31][30][30][30][31][34][30]


I'm assuming socket send is a single number.
I really don't have a clue what socket recv is at all...
that's what I'm trying to figure out.
What data is it actually sending?

Re: Hex to String??? by anonymous

anonymous
Mon Dec 01 17:14:54 CST 2003


>-----Original Message-----
>>What are you after, actually? It sounds like you want
>to take an actual hex
>>string representation of a number and do something else
>to it, but I'm not
>>sure what. If you want to take a Hex string and turn it
>into an actual
>>number again, you would prepend "&H" to it and convert
>it to a long...
>>
>>newNum = CLng( "&H" & myHexString )
>
>
>Here is what I have:
>Socket send:[10][0C][00]
>Socket recv:[10][0C][2C][F0][54][39][39][31][32][47][53]
>[43][33][34][39][33][20][20][20][20][20][20][20][20][20]
>[20][20][20][20][20][20][20][20][20][31][30][30][30][30]
>[35][31][30][30][30][31][34][30]
>
>
>I'm assuming socket send is a single number.
>I really don't have a clue what socket recv is at all...
>that's what I'm trying to figure out.
>What data is it actually sending?
>.

Actually it's probably recv a barcode... but can you
show me how I should know this?

Thanks again.

Re: Hex to String??? by Alex

Alex
Mon Dec 01 18:23:09 CST 2003

JesseH wrote:
>> What are you after, actually? It sounds like you want to take an
>> actual hex string representation of a number and do something else to
>> it, but I'm not sure what. If you want to take a Hex string and turn
>> it into an actual number again, you would prepend "&H" to it and
>> convert it to a long...

> Here is what I have:
> Socket send:[10][0C][00]
> Socket recv:[10][0C][2C][F0][54][39][39][31][32][47][53]
> [43][33][34][39][33][20][20][20][20][20][20][20][20][20]
> [20][20][20][20][20][20][20][20][20][31][30][30][30][30]
> [35][31][30][30][30][31][34][30]
>
>
> I'm assuming socket send is a single number.
> I really don't have a clue what socket recv is at all...
> that's what I'm trying to figure out.
> What data is it actually sending?

Those are bytes. You would do something like this with EACH hex numeric:

CByte(&H & value)
where value is the following short strings: "10", "0C", "00" etc.

That lets VBScript know that the values are hex (so "20" is treated like
char 32 instead of like char 20) and then converts each one to a byte, ready
to send



Re: Hex to String??? by Han

Han
Mon Dec 01 21:06:08 CST 2003

The hex values are not human-readable at least on my operating system.

set x=createobject("msxml2.domdocument.4.0")

str0="31"
str1="100C00"
str2="100C2CF054393931324753433334393320202020202020202020202020202020202031
303030303531303030313430"

x.loadxml "<x/>"
x.documentelement.datatype="bin.hex"
x.documentelement.text=str0

msgbox x.documentelement.nodetypedValue

The result should be "1" the string version of the str0 or the hex value
"31". While the str1 and str2 is not human readable.

--
Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
Have a nice day.

"JesseH" <anonymous@discussions.microsoft.com> wrote in message
news:aa7601c3b855$2a480600$a601280a@phx.gbl...
> >What are you after, actually? It sounds like you want
> to take an actual hex
> >string representation of a number and do something else
> to it, but I'm not
> >sure what. If you want to take a Hex string and turn it
> into an actual
> >number again, you would prepend "&H" to it and convert
> it to a long...
> >
> >newNum = CLng( "&H" & myHexString )
>
>
> Here is what I have:
> Socket send:[10][0C][00]
> Socket recv:[10][0C][2C][F0][54][39][39][31][32][47][53]
> [43][33][34][39][33][20][20][20][20][20][20][20][20][20]
> [20][20][20][20][20][20][20][20][20][31][30][30][30][30]
> [35][31][30][30][30][31][34][30]
>
>
> I'm assuming socket send is a single number.
> I really don't have a clue what socket recv is at all...
> that's what I'm trying to figure out.
> What data is it actually sending?



Re: Hex to String??? by anonymous

anonymous
Thu Dec 04 13:42:23 CST 2003

I think the not readable part is what was killing me.
Thanks for all your help!!!



>-----Original Message-----
>The hex values are not human-readable at least on my
operating system.
>
>set x=createobject("msxml2.domdocument.4.0")
>
>str0="31"
>str1="100C00"
>str2="100C2CF05439393132475343333439332020202020202020202
0202020202020202031
>303030303531303030313430"
>
>x.loadxml "<x/>"
>x.documentelement.datatype="bin.hex"
>x.documentelement.text=str0
>
>msgbox x.documentelement.nodetypedValue
>
>The result should be "1" the string version of the str0
or the hex value
>"31". While the str1 and str2 is not human readable.
>
>--
>Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
>Have a nice day.
>
>"JesseH" <anonymous@discussions.microsoft.com> wrote in
message
>news:aa7601c3b855$2a480600$a601280a@phx.gbl...
>> >What are you after, actually? It sounds like you want
>> to take an actual hex
>> >string representation of a number and do something
else
>> to it, but I'm not
>> >sure what. If you want to take a Hex string and turn
it
>> into an actual
>> >number again, you would prepend "&H" to it and convert
>> it to a long...
>> >
>> >newNum = CLng( "&H" & myHexString )
>>
>>
>> Here is what I have:
>> Socket send:[10][0C][00]
>> Socket recv:[10][0C][2C][F0][54][39][39][31][32][47]
[53]
>> [43][33][34][39][33][20][20][20][20][20][20][20][20]
[20]
>> [20][20][20][20][20][20][20][20][20][31][30][30][30]
[30]
>> [35][31][30][30][30][31][34][30]
>>
>>
>> I'm assuming socket send is a single number.
>> I really don't have a clue what socket recv is at
all...
>> that's what I'm trying to figure out.
>> What data is it actually sending?
>
>
>.
>