I am still trying to trim my script down...
C:\Data\Scripts\Golf>C:\Data\Kix2001\KiX2001.410\kix32 golf5b.kix
check for all registry keys Errors:0
check for registry value types in import1:0
check for registry value types in import2:0
check for registry value types in import3:0
check for registry values in import1:0
check for registry values in import2:0
check for registry values in import3:0
The UDF ImportRegFile passed the validation test.
Please do not forget to post your KiXtart Golf score.
KixGolf score = 840 code:
function ImportRegfile($)
Dim $A[4], $B, $C, $D, $G, $i, $K, $N, $o
$o = createobject("VBscript.RegExp")
$o.Global = 1
if ubound($)<0
$=$,""
endif
for each $B in $
$B=open(1,$B)
do
$C=$C+ReadLine(1)+"`"
until @error
$B=close(1)
next
$C=join(split($C,"\` "),"")
$o.Pattern = '`\[(\-?)(.*?)\](?=`)|`"?([\w\- ]+)?@@?"?=("|.{3,6}\:)?(.*?)"?(?=`)'
for each $B in $o.Execute($C)
for $i=0 to 4
$A[$i]=$B.SubMatches($i)
next
if $A[1]
$K=$A[1]
if $A[0]
$C=DelKey($K)
else
$C=AddKey($K)
endif
else
;Add Values
$N=$A[2]
$D=$A[4]
for $i=0 to 5
if $A[3]=split('dword: hex: " hex(2): hex(7):')[$i]
$=$i
endif
next
if $=0
$D=val("&"+$D)
endif
for each $C in split($D,",")
if $=3 | $C>"00" & $=5
$B=execute('$C=Chr(&'+$C+')')
endif
$G=""+$G+$C
next
$D=$G
$G=""
if $=5
$D=join(split($D,'0000'),"|")
endif
;Write Value
if $D="-"
$C=DelValue($K, $N)
else
$C=WriteValue($K, $N, $D, "REG_"+split('DWORD BINARY SZ EXPAND_SZ MULTI_SZ')[$])
endif
endif
next
$ImportRegfile=0
exit 0
endfunction
[ 22 July 2002, 01:28: Message edited by: Howard Bullock ]