BoogY Posted December 8, 2009 Share Posted December 8, 2009 Hi there every one... I come once more for your help.. i need to translate this vbScript in to autoit: expandcollapse popupon error resume next Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE Set objNetwork = CreateObject("Wscript.Network") strComputer = objNetwork.ComputerName Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.CreateTextFile("c:\" & strcomputer & ".txt", True) strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" strEntry1a = "DisplayName" strEntry1b = "QuietDisplayName" Set objReg = GetObject("winmgmts://" & strComputer & _ "/root/default:StdRegProv") objReg.EnumKey HKLM, strKey, arrSubkeys For Each strSubkey In arrSubkeys intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _ strEntry1a, strValue1) If intRet1 <> 0 Then objReg.GetStringValue HKLM, strKey & strSubkey, _ strEntry1b, strValue1 End If If strValue1 <> "" Then objTextFile.WriteLine strValue1 & "¿ " & strcomputer & "¿" End If Next strKey2 = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" strEntry2a = "DisplayName" strEntry2b = "QuietDisplayName" Set objReg = GetObject("winmgmts://" & strComputer & _ "/root/default:StdRegProv") objReg.EnumKey HKLM, strKey2, arrSubkeys For Each strSubkey In arrSubkeys intRet2 = objReg.GetStringValue(HKLM, strKey2 & strSubkey, _ strEntry2a, strValue2) If intRet2 <> 0 Then objReg.GetStringValue HKLM, strKey & strSubkey, _ strEntry2b, strValue2 End If If strValue2 <> "" Then objTextFile.WriteLine strValue2 & "¿ " & strcomputer & "¿" End If Next objTextFile.Close Thanks a lot for your help Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 Do you expect us to do your work for you? github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted December 8, 2009 Author Share Posted December 8, 2009 (edited) No I'm trying my self. Prof : i made it like this : is this correct ? expandcollapse popupFunc listInstalledApps() Const $HKLM = "&H80000002" ;HKEY_LOCAL_MACHINE $objNetwork = ObjCreate("Wscript.Network") $strComputer = $objNetwork.ComputerName $objFSO = ObjCreate("Scripting.FileSystemObject") $objTextFile = $objFSO.CreateTextFile("c:\" & $strcomputer & ".txt", True) $strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $strEntry1a = "DisplayName" $strEntry1b = "QuietDisplayName" $objReg = ObjGet("winmgmts://" & $strComputer & "/root/default:StdRegProv") $objReg.EnumKey $HKLM, $strKey, $arrSubkeys For $strSubkey In $arrSubkeys $intRet1 = $objReg.GetStringValue($HKLM, $strKey & $strSubkey, $strEntry1a, $strValue1) If $intRet1 <> 0 Then $objReg.GetStringValue $HKLM, $strKey & $strSubkey, $strEntry1b, $strValue1 EndIf If $strValue1 <> "" Then $objTextFile.WriteLine $strValue1 & "¿ " & $strcomputer & "¿" EndIf Next $strKey2 = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" $strEntry2a = "DisplayName" $strEntry2b = "QuietDisplayName" $objReg = ObjGet("winmgmts://" & $strComputer & "/root/default:StdRegProv") $objReg.EnumKey $HKLM, $strKey2, $arrSubkeys For $strSubkey In $arrSubkeys $intRet2 = $objReg.GetStringValue($HKLM, $strKey2 & $strSubkey, $strEntry2a, $strValue2) If $intRet2 <> 0 Then $objReg.GetStringValue $HKLM, $strKey & $strSubkey, $strEntry2b, $strValue2 EndIf If $strValue2 <> "" Then $objTextFile.WriteLine $strValue2 & "¿ " & $strcomputer & "¿" EndIf Next $objTextFile.Close EndIf Edited December 8, 2009 by BoogY Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 Looks ok. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted December 8, 2009 Author Share Posted December 8, 2009 Its giving me this error : E:\PERSO\Scripts\au3\Projects\PC Scanner\lib.au3 (123) : ==> The requested action with this object has failed.: $objReg.EnumKey $HKLM, $strKey, $arrSubkeys $objReg.EnumKey ^ ERROR >Exit code: 1 Time: 0.537 I dont know if its ok how i change the script in this part Link to comment Share on other sites More sharing options...
Juvigy Posted December 8, 2009 Share Posted December 8, 2009 Change $objReg.EnumKey $HKLM, $strKey, $arrSubkey to $objReg.EnumKey($HKLM, $strKey, $arrSubkey) Link to comment Share on other sites More sharing options...
BoogY Posted December 8, 2009 Author Share Posted December 8, 2009 i dit'it but still the same error Link to comment Share on other sites More sharing options...
Authenticity Posted December 8, 2009 Share Posted December 8, 2009 HKLM is not the string representation of the hexadecimal value but 0x80000002. More here 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