Dear Kent,

We had see your input already. We were just waiting on other reactions before we
had the intention to return some input on your efforts. Possible, that we saw some
interesting input.

Some elements in your versions show new ideas.

So we can make your script a little bit smaller when we are removing downward compatible
requirements and when we doesn't need the debugging capabilities.
Also we see some things which need some corrects.

Some remarks and suggestions:
  • we aren't using variables when we are referencing them only once. variables without
    any reference can be also comment f.e. $pgmvrs.
  • you are starting in the first WHILE/LOOP structure with the wrong $i value.
    it should be $i=1. it isn't your intention to copy an existing control file
    to your "X:\Scripts" location we suppose.
  • one of your last lines in second example $updinfo= is missing any goal. you
    aren't referencing them.
  • in the line IF Exist($destdir+$kixfl[0]) $destdir+$kixfl[0] ENDIF we are missing DELcommand.
  • we are missing the last three lines, which makes it possible to do some error checking
    from a batch job.
  • also you can replace the control file kix420.ok by registry entry, which makes
    your code also a little bit smaller.
    also it is possible that you are creating only one control file in the %windir% directory.
    the other location is only for backwards compatibility.
  • of course you need only one script to start installation, but in our version we have introduce
    both start1.kix and start2.kix versions to make it possible that we can help
    others with their problems by using our iexpress package.
  • of course the amount of information can reduced. for us it are only debugging issues.
    to claim a reducing with 396,89% isn't fair. without any debugging facility you must make
    the comparison with the start1.kix script only.
    with the above remarks included we can reduce your script
    into
    start1.kix 2.862 bytes (reducing 140.25%)
    or
    start1.kix 2.596 bytes (reducing 154.62%)
    or
    start1.kix 2.217 bytes (reducing 181.11%)
    Also you shouldn't forget that IEXPRESS compress those information too.
    More important is how much time both versions will cost during an installation process.
    With the UPCTimer 1.6 we get for our versions:
    code:
    - kix421update.exe                        0.112393 sec
    - kix421registry.exe 0.133719 sec
    - wkix421update.exe 0.088145 sec

    So what is small.
Reaction on your 2 Pennies
  • (1)why? when we are running it on our environment we doesn't need a debugging script
    liike start2.kix.
    more important is, that we can instruct people in an easy way to create debugging
    information about their iexpress installation when they have problems with it.
    Oh yeh, how did we solve the "terminal service" model? with a debug file.
  • (2)why over-use parenthises? indeed to make it more "bullet-proof" and to get
    a better layout in our opinion.
  • (3) ???
  • (4) why not use variables? in some situations it is possible, but we didn't.
    general people aren't see anything from our code.
    in some situations we are doing things twice to make reading not too hard.
    currently we are running our twenties version.
Reaction on the two Pennies of Les
  • indeed we are also missing the WKIX32.EXE. But it is important to know
    in which way Kent is creating his IEXPRESS package. It is f.e. possible
    that he is call WKIX32.EXE KIX32.EXE in his version.
  • sorry Les. Kent isn't installating DLL's when they aren't needed. He only
    verifies "do they exist and when positive remove them".
    Script contains only one COPY statement. See the first WHILE/LOOP structure.
Our version based on your second version
code:
DIM $max,$kixfl[$max+1] ; vs 3.10
$tmp=ExpandEnvironmentVars('%tmp%'+'\')
$srcdir=@curdir+'\'
$destdir=Substr('%WINDIR%',1,3)+'Scripts'
$message=Substr(@kix,1,1)+Substr(@kix,3,2)
;
IF Exist($destdir)=0
MD $destdir
ENDIF
IF Len($destdir)=0
$destdir=@lanroot
ENDIF
IF Substr($destdir,Len($destdir),1) <> '\'
$destdir=$destdir+'\'
ENDIF
;
IF @inwin=1
$max=1
ELSE
$max=4
ENDIF
$kixfl[0]='kix'+$message+'.ok'
$kixfl[1]='kix32.exe'
$kixfl[2]='kx16.dll'
$kixfl[3]='kx32.dll'
$kixfl[4]='kx95.dll'
$firstinst='yes'
IF Exist($destdir+$kixfl[0])
$firstinst='no'
ELSE
DEL $destdir+'kix*.ok'
ENDIF
;
$updinfo=''
$i=1
WHILE $i <= $max
$srcfl=$srcdir+$kixfl[$i]
$destfil=$destdir+$kixfl[$i]
IF Exist($destfil)
$rc=SetFileAttr($destfil,128) <> 0
ENDIF
IF Exist($srcfl)
IF GetFileSize($srcfl) <> GetFileSize($destfil) OR
GetFileTime($srcfl) <> GetFileTime($destfil) OR
GetFileVersion($srcfl,'filedescription') <> GetFileVersion($destfil,'filedescription') OR
GetFileVersion($srcfl,'fileversion') <> GetFileVersion($destfil,'fileversion') OR
GetFileVersion($srcfl,'internalname') <> GetFileVersion($destfil,'internalname') OR
GetFileVersion($srcfl,'language') <> GetFileVersion($destfil,'language') OR
GetFileVersion($srcfl,'originalfilename') <> GetFileVersion($destfil,'originalfilename') OR
GetFileVersion($srcfl,'productname') <> GetFileVersion($destfil,'productname')
COPY $srcfl $destfil /h
$updinfo=$updinfo+' +'+$kixfl[$i]
ELSE
$updinfo=$updinfo+' ='+$kixfl[$i]
ENDIF
ENDIF
$i=$i+1
LOOP
;
$upok='yes'
$i=1
WHILE $i <= $max
$destfil=$destdir+$kixfl[$i]
IF Exist($destfil) = 0
$upok='no'
$updinfo=$updinfo+' unknown_file.'+$kixfl[$i]
$rc=WriteProfileString($destdir+$kixfl[0],'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file')
ELSE
$buildinfo=GetFileVersion($destfil,'specialbuild')
IF Len($buildinfo) > 0
$buildinfo=' ('+Lcase($buildinfo)+')'
ENDIF
$rc=WriteProfileString($destdir+$kixfl[0],'KiX',$kixfl[$i],@date+' '+@time+' -> '+GetFileTime($destfil)+' '+GetFileSize($destfil)+$buildinfo)
ENDIF
$i=$i+1
IF @inwin=1 $i=$max+1
ENDIF
LOOP
$i=$max
IF @inwin <> 1
$max=4
$i=2
WHILE $i <= $max
$destfil=$destdir+$kixfl[$i]
IF Exist($destfil)
$rc=SetFileAttr($destfil,128) <> 0
DEL $destfil
ENDIF
$updinfo=$updinfo+' ?'+$kixfl[$i]
$i=$i+1
LOOP
ENDIF
IF $upok='yes'
$state='install complete at '
$info=$state+@date+' '+@time+' '+$updinfo
ELSE
$state='install incomplete at '
$info='update kix'+$message
IF Exist($destdir+$kixfl[0])
DEL $destdir+$kixfl[0]
ENDIF
ENDIF
$rc=WriteProfileString($dfl,'KiX','KiX release',@producttype+' -> kix '+@kix)
$rc=WriteProfileString($dfl,'KiX','KiX',$info)
;
IF Exist($destdir+'kix'+$message+'.ok')
EXIT(0)
ELSE
EXIT(1)
ENDIF

The reduced version
code:
dim $x1,$x2[$x1+1] $x3=ExpandEnvironmentVars('%tmp%'+'\') $x4=@curdir+'\' $x5=Substr('%WINDIR%',1,3)+'Scripts' $x6=Substr(@kix,1,1)+Substr(@kix,3,2) if Exist($x5)=0 md $x5 endif if Len($x5)=0 $x5=@lanroot endif
if Substr($x5,Len($x5),1)<>'\' $x5=$x5+'\' endif if @inwin=1 $x1=1 else $x1=4 endif $x2[0]='kix'+$x6+'.ok' $x2[1]='kix32.exe' $x2[2]='kx16.dll' $x2[3]='kx32.dll' $x2[4]='kx95.dll' $x7='yes'
if Exist($x5+$x2[0]) $x7='no' else del $x5+'kix*.ok' endif $x8='' $x9=1 while $x9<=$x1 $x10=$x4+$x2[$x9] $x11=$x5+$x2[$x9] if Exist($x11) $x12=SetFileAttr($x11,128)<>0 endif if Exist($x10)
if GetFileSize($x10)<>GetFileSize($x11) OR GetFileTime($x10)<>GetFileTime($x11) OR GetFileVersion($x10,'filedescription')<>GetFileVersion($x11,'filedescription') OR GetFileVersion($x10,'fileversion')<>GetFileVersion($x11,'fileversion') OR
GetFileVersion($x10,'internalname')<>GetFileVersion($x11,'internalname') OR GetFileVersion($x10,'language')<>GetFileVersion($x11,'language') OR GetFileVersion($x10,'originalfilename')<>GetFileVersion($x11,'originalfilename') OR
GetFileVersion($x10,'productname')<>GetFileVersion($x11,'productname') copy $x10 $x11 /h $x8=$x8+' +'+$x2[$x9] else $x8=$x8+' ='+$x2[$x9] endif endif $x9=$x9+1 loop $x13='yes' $x9=1 while $x9<=$x1 $x11=$x5+$x2[$x9]
if Exist($x11)=0 $x13='no' $x8=$x8+' unknown_file.'+$x2[$x9] $x12=WriteProfileString($x5+$x2[0],'KiX',$x2[$x9],@date+' '+@time+' -> unknown file') else $x14=GetFileVersion($x11,'specialbuild') if Len($x14)>0
$x14=' ('+Lcase($x14)+')' endif $x12=WriteProfileString($x5+$x2[0],'KiX',$x2[$x9],@date+' '+@time+' -> '+GetFileTime($x11)+' '+GetFileSize($x11)+$x14) endif $x9=$x9+1 if @inwin=1 $x9=$x1+1 endif loop $x9=$x1
if @inwin<>1 $x1=4 $x9=2 while $x9<=$x1 $x11=$x5+$x2[$x9] if Exist($x11) $x12=SetFileAttr($x11,128)<>0 del $x11 endif $x8=$x8+' ?'+$x2[$x9] $x9=$x9+1 loop endif
if $x13='yes' $x15='install complete at ' $x16=$x15+@date+' '+@time+' '+$x8 else $x15='install incomplete at ' $x16='update kix'+$x6 if Exist($x5+$x2[0]) del $x5+$x2[0] endif endif
$x12=WriteProfileString($x17,'KiX','KiX release',@producttype+' -> kix '+@kix) $x12=WriteProfileString($x17,'KiX','KiX',$x16) if Exist($x5+'kix'+$x6+'.ok') exit (0) else exit (1) endif

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA