#59017 - 2001-09-12 04:28 PM
Kix error when doing a DecToHex
|
Anonymous
Anonymous
Unregistered
|
Ok...I've written a rather extensive script, but I kept erroring at one "simple" spot, so I reduced that section to a second program, and am STILL getting an errorThe code is: code:
$version = Readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion","ProductVersion") rtrim(ltrim($version)) $jasper = DecToHex ($version) messagebox ("$jasper","test",0)
and the error is: 55706351Script error : error in $jasper = DecToHex ($version) where the 55706351 is the decimal value of $version, though I need it in HEX...Anyone got anythoughts? ps. I'm using Kixtart 95 v3.63 [ 12 September 2001: Message edited by: Skorpyo ]
|
|
Top
|
|
|
|
#59018 - 2001-09-12 04:34 PM
Re: Kix error when doing a DecToHex
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Skorpyo, what happens if you replace :
rtrim(ltrim($Version)) with : $Version = val($Version) or just say : $version = val(readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion","ProductVersion")) ... just a guess
Jochen
btw. 55706351 in HEX is 35202EF ... doesn't make sense either !?!
[ 12 September 2001: Message edited by: jpols ]
_________________________
|
|
Top
|
|
|
|
#59019 - 2001-09-12 04:47 PM
Re: Kix error when doing a DecToHex
|
Anonymous
Anonymous
Unregistered
|
Thank you! that fixed that prob! now the only problem I have is that I need to treat the resultant as a string so I can extract the second set of hex characters. Got a tip for that?Skorpyo
|
|
Top
|
|
|
|
#59020 - 2001-09-12 04:51 PM
Re: Kix error when doing a DecToHex
|
Anonymous
Anonymous
Unregistered
|
BTW...what I need the second hex set for is that the last 4 char (second set) convert back to dec as 751 in this case...and I need that number to determine the following actions the script runs.So now that I can convert it to hex, I need to evaluate if it's 7 or 8 characters long (truncated because there was a leading 0) and then chop the last 4 characters, and convert them back to dec. so this is a really annoying thing to have to do. Thanks for the help, Skorpyo
|
|
Top
|
|
|
|
#59021 - 2001-09-12 05:28 PM
Re: Kix error when doing a DecToHex
|
DrillSergeant
MM club member
   
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
Hi,Is this what you're looking for? code:
BREAK ON CLS$dec="55706351" $val=val($dec) $hex=decToHex($val) ? $hex $last=substr("$hex",len($hex)-3,len($hex)) ? $last $new=val("&$last") ? $new
_________________________
The Code is out there
|
|
Top
|
|
|
|
#59022 - 2001-09-12 05:28 PM
Re: Kix error when doing a DecToHex
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
... something like :code:
break on cls$jasper = 55706351 ; or your readvalue  $hex = dectohex($jasper) $hex = substr($hex,len($hex)-3,4) $c = 1 $jasper = 0 do $x = substr($hex,$c,1) select case $x = "A" $x = 10 case $x = "B" $x = 11 case $x = "C" $x = 12 case $x = "D" $x = 13 case $x = "E" $x = 14 case $x = "F" $x = 15 case 1 $x = val($x) endselect select case $c = 4 $jasper = $jasper + $x case $c = 3 $jasper = $jasper + $x * 16 case $c = 2 $jasper = $jasper + $x * 16 * 16 case $c = 1 $jasper = $jasper + $x * 16 * 16 * 16 endselect $c = $c + 1 until $c = 5 $jasper ? get $
??? I know it's a bit clumsy but hey that's 3.63 and it seems to be correct ! hth
Jochen
_________________________
|
|
Top
|
|
|
|
#59024 - 2001-09-12 05:37 PM
Re: Kix error when doing a DecToHex
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Arrrghhh ,Sorry Sarge ! I didn't read your sample accurately enough and seem to forgot all the basics ('&') during my vacation !!! Wanna shoot me ? load - aim - and fire !!! J. 
_________________________
|
|
Top
|
|
|
|
#59025 - 2001-09-12 05:44 PM
Re: Kix error when doing a DecToHex
|
Anonymous
Anonymous
Unregistered
|
wow...you guys are GOOD! this is perfect! Thank you both very much, because as you can likely guess, I'm no programmer, and am AWFUL at this apparently . Thanks again, Skorpyo
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1619 anonymous users online.
|
|
|