Matz Posted September 5, 2006 Share Posted September 5, 2006 Hi. Anyone got a tip on how to list the keys in HKEY_CLASSES_ROOT that hav an "." in front of them? For example... [HKEY_CLASSES_ROOT\.zip] @="WinZip" This is the "(default)" key under [HKEY_CLASSES_ROOT\.zip] that show what app that opens this type of file. I'm building a search for users that wants to know what kind of filetypes a particular app is using ------------------------------------------ : Have you tried the new vista? : No... I don't play games... Link to comment Share on other sites More sharing options...
Xandl Posted September 5, 2006 Share Posted September 5, 2006 You could type "assoc" in the dos box, it gives the same result. Link to comment Share on other sites More sharing options...
Matz Posted September 5, 2006 Author Share Posted September 5, 2006 You could type "assoc" in the dos box, it gives the same result.Thanks! That should do the trick actually... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 5, 2006 Moderators Share Posted September 5, 2006 If you were wanting a long UDF, this could start you off:$aArrayReturned = _RegEnum('HKEY_CLASSES_ROOT\') Func _RegEnum($sKey) Local $aArray[1][1], $sEnum, $sHold, $iCC While 1 $iCC += 1 $sEnum = RegEnumKey($sKey, $iCC) If @error Then ExitLoop If StringLeft($sEnum, 1) = '.' Then $sHold &= $sEnum & Chr(01) EndIf WEnd MsgBox(0, '', $sHold);could use StringSplit(StringTrimRight($sHold, 1), Chr(01)) to make it an array EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Matz Posted September 5, 2006 Author Share Posted September 5, 2006 If you were wanting a long UDF, this could start you off:$aArrayReturned = _RegEnum('HKEY_CLASSES_ROOT\') Func _RegEnum($sKey) Local $aArray[1][1], $sEnum, $sHold, $iCC While 1 $iCC += 1 $sEnum = RegEnumKey($sKey, $iCC) If @error Then ExitLoop If StringLeft($sEnum, 1) = '.' Then $sHold &= $sEnum & Chr(01) EndIf WEnd MsgBox(0, '', $sHold);could use StringSplit(StringTrimRight($sHold, 1), Chr(01)) to make it an array EndFunc Thanks Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 5, 2006 Moderators Share Posted September 5, 2006 Thanks LOL, this seems to be much faster using xandl's suggestion!! #include <array.au3> $aReturned = _AssocExt() _ArrayDisplay($aReturned, 'Array') Func _AssocExt() RunWait(@ComSpec & ' /c assoc > "' & @TempDir & '\AssocOutput.txt"', '', @SW_HIDE) If Not FileExists(@TempDir & '\AssocOutput.txt') Then Return SetError(1, 0, 0) Local $aSplit = StringSplit(StringStripCR(FileRead(@TempDir & '\AssocOutput.txt')), @LF) FileDelete(@TempDir & '\AssocOutput.txt') Return $aSplit EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Matz Posted September 5, 2006 Author Share Posted September 5, 2006 LOL, this seems to be much faster using xandl's suggestion!! #include <array.au3> $aReturned = _AssocExt() _ArrayDisplay($aReturned, 'Array') Func _AssocExt() RunWait(@ComSpec & ' /c assoc > "' & @TempDir & '\AssocOutput.txt"', '', @SW_HIDE) If Not FileExists(@TempDir & '\AssocOutput.txt') Then Return SetError(1, 0, 0) Local $aSplit = StringSplit(StringStripCR(FileRead(@TempDir & '\AssocOutput.txt')), @LF) FileDelete(@TempDir & '\AssocOutput.txt') Return $aSplit EndFunc I know... Just what I needed actually. Hehe... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 5, 2006 Moderators Share Posted September 5, 2006 I know... Just what I needed actually. Hehe...How about we take it one step more... read them, then write them to your own .ini then use IniReadSection() to get all the Keys and their Values stored nice and neat right there for you:$hOutFile = @ScriptDir & '\AssocIni.ini' $sString = _AssocExt($hOutFile) $aSection = IniReadSection($hOutFile, 'AssocExtValues') If IsArray($aSection) Then For $iCC = 1 To $aSection[0][0] MsgBox(64, 'Info', 'Key = ' & $aSection[$iCC][0] & @CR & _ 'Value = ' & $aSection[$iCC][1]) Next EndIf Func _AssocExt($hOutIni) RunWait(@ComSpec & ' /c assoc > "' & @TempDir & '\AssocOutput.txt"', '', @SW_HIDE) If Not FileExists(@TempDir & '\AssocOutput.txt') Then Return SetError(1, 0, 0) Local $sFRead = FileRead(@TempDir & '\AssocOutput.txt') FileDelete(@TempDir & '\AssocOutput.txt') FileClose(FileOpen($hOutIni, 2)) FileWriteLine($hOutIni, '[AssocExtValues]') Return FileWrite($hOutIni, $sFRead) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now