Classes
; Extract directly openable .### filename Classes from registry.
; File types which are not 'double clickable' will be excluded.
Function CLASSES
;Setup test file output
GLOBAL $base
DIM $Dest, $CLASSES, $CLASSES#
$base="HKEY_CLASSES_ROOT\"
$Dest="%USERPROFILE%\DESKTOP\"
$CLASSES=$Dest+"%COMPUTERNAME%_CLASSES.txt"
$CLASSES#=$Dest+"%COMPUTERNAME%_CLASSES+.txt"
IF exist ($CLASSES)
DEL $CLASSES /f
ENDIF
IF exist ($CLASSES#)
DEL $CLASSES# /f
ENDIF
DIM $nul
Open(2, $CLASSES,5)
Open(3, $CLASSES#,5)
If @error = 0
$null = ParseKeys() ; Run Query
Endif
Close (3)
Close (2)
EndFunction
;Extract the .### suffixes from the registry.
FUNCTION Parsekeys()
DIM $subkey
DIM $retvalue
$retvalue = ENUMKEY($base,$subkey)
WHILE @error=0
IF $retvalue <> "" and left($retvalue,1) = "."
$null = LogKeys($retvalue)
ENDIF
$subkey=$subkey+1
$retvalue = ENUMKEY($base,$subkey)
LOOP
ENDFUNCTION
;For each of the .### suffixes, determine which application runs it.
FUNCTION LogKeys($ext)
DIM $ft, $key, $app,$x,$y, $SH
$key=$base+$ext
$SH = readvalue($key+"\"+$ft,"")
If $SH = ""
$ft = Enumkey($key,0)
$app= readvalue($key+"\"+$ft,"")
SELECT
Case $ft = "OpenWithProgIDs"
$x= $key+"\"+$ft+"\"+$app
If keyexist($x) = 1
$y=$base+readvalue($x,"")+"\shell\Open\command"
If keyexist($y) = 1
StripIt(readvalue($y,""),$ext)
Endif
Endif
case $ft = "OpenWithList"
StripIt($APP,$ext)
EndSelect
Else
$x= $base+$SH+"\shell\Open\command"
If keyexist($x) = 1
StripIt(readvalue($x,""),$ext)
Endif
Endif
ENDFUNCTION
FUNCTION StripIt($S,$ext)
DIM $x, $y, $ct, $STR
;Strip out Quotes
For $x = 1 to len($S)
$y = substr($S,$x,1)
If $y <> '"' and $ct < 2
$STR=$STR+$y
Else
if $ct <2
$ct=$ct+1
Endif
Endif
next
;Strip off %1 to leave active string
SELECT
CASE right($Str,3) = " %L"
$Str = left($str,-3)
CASE right($Str,3) = " %1"
$Str = left($str,-3)
CASE right($Str,2) = "%1"
$Str = left($str,-2)
CASE right($Str,5) = " '%1'"
$Str = left($str,-5)
EndSelect
;Create Output File
If $Str <>""
$ = WriteLine(3,$ext+','+$str+@CRLF)
$ = WriteLine(2,$ext+@CRLF)
Endif
ENDFUNCTION