Sorry about double posting - I meant to put this here, not in Scripts.
This was based on Radimus's original script in Make Kix scripts run by double clicking them but has evolved to be suitable for associating almost anything...
As I only run KiX scripts from a console and never a double click and only edit with TextPad and never right-click, I have removed all that functionality.
This script sets up .KIX and .K2K files so that on the command line in NT:
C:\>scriptname.kix $var=value ...
and Win9x:
C:\>start scriptname.kix $var=value ...
I don't use and haven't tested Win9x functionality, BTW, so if it doesn't work I would suggest you use Radimus's script.
With Rad's script... if you add %* to the command line, after the %1, it will pass all additional parameters to the script. Again, IDK about Win9x for this.
How it works:
We define some arrays and use them to setup the file extension (.KIX), the name to display in Explorer or Assoc (KiXtart95 Scripts), the executable to run (kix32.exe) and whether this is to be added or removed from the registry.
Note: When removing an association, the Name and Executable are not required and can be set to "" (null)
KiXReg.k2k
code:
break on
; create empty arrays
dim $bAction[2] ; The number in [ ] is the total number of extensions
dim $saExtension[2] ; There are only 2 extensions in this script now...
dim $saName[2] ; Change this if you change the number of extensions
dim $saExecutable[2] ; These are 0 based arrays, 0,1,2...etc
; set action to 0 or 1: 0 will delete this extension and 1 will add it
$bAction[0]=1 ; add
$bAction[1]=1 ; add
; set file extensions
$saExtension[0]=".KIX" ; extension for KiXtart version 3.x files
$saExtension[1]=".K2K" ; extension for KiXtart 2001 files
; set display name
$saName[0]="KiXtart95 Script" ; KiXtart version 3.x files
$saName[1]="KiXtart2001 Script" ; KiXtart 2001 files
; set KIX.exe filespec
$saExecutable[0]="c:\scripts\k.exe" ; KiXtart 3.63: kix32.exe
$saExecutable[1]="c:\scripts\k2.exe" ; KiXtart 2001: kix32c.exe
;-------------------------------------------------------------don't look down---------
for $iIndex=0 to UBound($saExtension)
; display current extension
? "*" $saExtension[$iIndex] " : "
; convert extension to class root for use in the registry
$saExtension[$iIndex]="HKEY_CLASSES_ROOT\"+$saExtension[$iIndex]
; Add or Remove?
if $bAction[$iIndex]
; create extension with executable
Addkey($saExtension[$iIndex])
writevalue($saExtension[$iIndex], "", $saName[$iIndex], REG_SZ)
writevalue($saExtension[$iIndex], "EditFlags", "0", REG_SZ)
Addkey($saExtension[$iIndex]+"\DefaultIcon")
writevalue($saExtension[$iIndex]+"\DefaultIcon", "", "C:\WINNT\system32\SHELL32.dll,21", REG_EXPAND_SZ)
Addkey($saExtension[$iIndex]+"\shell")
writevalue($saExtension[$iIndex]+"\shell", "", "Run", REG_SZ)
Addkey($saExtension[$iIndex]+"\shell\Run")
Addkey($saExtension[$iIndex]+"\shell\Run\command")
writevalue($saExtension[$iIndex]+"\shell\Run\command", "", $saExecutable[$iIndex]+" %%1 %%*", REG_EXPAND_SZ)
else
; remove entire association
deltree($saExtension[$iIndex])
endIf
next
cj
------------------
For more scripts goto my website and click the hammer and spanner icon.
chrismat@ozemail.com.au