ptrex Posted June 5, 2005 Share Posted June 5, 2005 I have transposed a VBscript that gets some WMI object information in AutoIT. I used the Beta version of AutoIT for it. This script runs OK (no errors messages), but the output is not correct. Since there is no information yet available in the Help files, relating to the new features of the Beta version. I would appreciated some feedback. This is the VBscript : On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * from Win32_PhysicalMemoryArray") For Each objItem in colItems Wscript.Echo "Description: " & objItem.Description Next This is the AutoIt version : $strComputer = "." $objWMIService = objGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colItem = $objWMIService.ExecQuery("Select Description from Win32_PhysicalMemoryArray") Msgbox (0, "Description: ", $colItem, 2) I did some guesing for translating this in AutoIT I saw that the VB syntax CreateObject is translated in ObjCreate in AutoIt So I guesed that the VB syntax GetObject is translated to ObjGet ??!! Are there some help files available. I would be interested to access the WMI objects in AutoIt. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
GaryFrost Posted June 5, 2005 Share Posted June 5, 2005 Might try search for Scriptomatic heres code generated by it: expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemoryArray", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Depth: " & $objItem.Depth & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "Height: " & $objItem.Height & @CRLF $Output = $Output & "HotSwappable: " & $objItem.HotSwappable & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "Location: " & $objItem.Location & @CRLF $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF $Output = $Output & "MaxCapacity: " & $objItem.MaxCapacity & @CRLF $Output = $Output & "MemoryDevices: " & $objItem.MemoryDevices & @CRLF $Output = $Output & "MemoryErrorCorrection: " & $objItem.MemoryErrorCorrection & @CRLF $Output = $Output & "Model: " & $objItem.Model & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "OtherIdentifyingInfo: " & $objItem.OtherIdentifyingInfo & @CRLF $Output = $Output & "PartNumber: " & $objItem.PartNumber & @CRLF $Output = $Output & "PoweredOn: " & $objItem.PoweredOn & @CRLF $Output = $Output & "Removable: " & $objItem.Removable & @CRLF $Output = $Output & "Replaceable: " & $objItem.Replaceable & @CRLF $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF $Output = $Output & "SKU: " & $objItem.SKU & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "Tag: " & $objItem.Tag & @CRLF $Output = $Output & "Use: " & $objItem.Use & @CRLF $Output = $Output & "Version: " & $objItem.Version & @CRLF $Output = $Output & "Weight: " & $objItem.Weight & @CRLF $Output = $Output & "Width: " & $objItem.Width & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PhysicalMemoryArray" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DaleHohm Posted June 5, 2005 Share Posted June 5, 2005 Since there is no information yet available in the Help files, relating to the new features of the Beta version. I would appreciated some feedback.<{POST_SNAPBACK}>Please look again. The helpfile that is installed with the beta is pretty complete.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
/dev/null Posted June 5, 2005 Share Posted June 5, 2005 $colItem = $objWMIService.ExecQuery("Select Description from$colItem is an array. You can't just display that array with msgbox. You need to "translate" the for loop to AutoIT as well.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
SvenP Posted June 5, 2005 Share Posted June 5, 2005 (edited) $colItem is an array. You can't just display that array with msgbox. You need to "translate" the for loop to AutoIT as well.CheersKurt<{POST_SNAPBACK}>Yep, Kurt is right.ptrex: You forgot to convert these vb script:For Each objItem in colItems Wscript.Echo "Description: " & objItem.Description NextThat would be:For $objItem in $colItems Msgbox(0,"","Description: " & $objItem.Description) NextRegards,-Sven Edited June 5, 2005 by SvenP Link to comment Share on other sites More sharing options...
ptrex Posted June 6, 2005 Author Share Posted June 6, 2005 Hi Guys, Thanks for the numerous feedback. The Solution of Kurt and Sven did it. Nevertheless I selected 1 item in the Array to display, It still needed the For ... Loop. 2 items open from the feedback : DaleHohm : I did a search in the AutoITX help on ObjCreate and ObjGet but no results. I' ve used the AutoITx Help file which is 159 Kb large dated 06/04/2005 Still gafrost: I' ve installed Scriptomatic now. How did you manage to get an AutIT script out of it. Because It only supports VBscript, Perl, Jscript and Phyton. Or did you create a VBscript from it and manually modified it to AutoIT script ? By the way the script you added didn't run. Thanks a lot. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
GaryFrost Posted June 6, 2005 Share Posted June 6, 2005 (edited) Scriptomatic here on this forum.http://www.autoitscript.com/forum/index.ph...opic=10534&st=0 Edited June 6, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ptrex Posted June 6, 2005 Author Share Posted June 6, 2005 gafrost: Thanks al lot for the tip !!! This can save me a lot of time. Regarding the Help on AutoITX - ObjCreate and ObjGet, seemes that I was looking in the wrong Helpfile. For anyone still interested : For help on these subjects you don' t need to look into the AutoITx help file, but in the regaular AutoIT help file Thanks you all for the support eventually everythings is sorted out. AutoIT is the MAX !!! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
/dev/null Posted June 6, 2005 Share Posted June 6, 2005 >I did a search in the AutoITX help on ObjCreate and ObjGet but no results.You will need the latest Beta. Help file > 1 MB. See links to beta versions at bottom of download page.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * 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