MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Kent, reducing a script with variable names like $x1, $x2, ..., $x35. Isn't good programming at all, but when a script goes in production it isn't relevant what layout that script will get. At least the original script including comment and right indentation is your source for edit operations.
A good issue is "kixtart has an internal error control capabilities", which will be gone when we combine different lines input one very long line. Of course it is possible, that you reduce your scripts by removing unwanted comment, spaces and 'print'-statements. Just use as kixstrip call
code:
kixstrip input.kix output.kix /nocombine /noheaders /nolicense
The result with our input can be
code:
DIM $max,$kixfl[$max+1] $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 other suggestion about upgrading $os is also a good suggestion. Such implementation is indeed possible. We put it also on our TO-DO list.
The result looks great. Bravo. greetings.
(TO_DO: kixstip + "$os" + put some ideas in our version)
|