Jump to content

how to put wmi information in an edit or richedit?


Go to solution Solved by Subz,

Recommended Posts

How about everyone I have a question... Is it possible that the information obtained through WMI (with Scriptomatic) can be placed in an Edit or Rich Edit? since I have tried it and it does not mark or place the text in the edit or richedit only in Mgsbox, any ideas?

 

Link to comment
Share on other sites

;SystemInfo (COM) by TesterMachine

;Mostrar GUI:

;Includes:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>

;Functions:
$Form1 = GUICreate("Form1", 611, 354, 202, 115)
;$Edit1 = GUICtrlCreateEdit("", 0, 0, 609, 313)
$edt = _GUICtrlRichEdit_Create($Form1, "", 0, 0, 609, 313, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_EX_CLIENTEDGE))
$CopyButton = GUICtrlCreateButton("Copy Clipboard", 32, 320, 129, 25)
$Button2 = GUICtrlCreateButton("About", 461, 321, 129, 25)
GUISetState(@SW_SHOW)

; 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_BIOS", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $strBiosCharacteristics = $objItem.BiosCharacteristics(0)
      $Output = $Output & "BiosCharacteristics: " & $strBiosCharacteristics & @CRLF
      $strBIOSVersion = $objItem.BIOSVersion(0)
      $Output = $Output & "BIOSVersion: " & $strBIOSVersion & @CRLF
      $Output = $Output & "BuildNumber: " & $objItem.BuildNumber & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "CodeSet: " & $objItem.CodeSet & @CRLF
      $Output = $Output & "CurrentLanguage: " & $objItem.CurrentLanguage & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "EmbeddedControllerMajorVersion: " & $objItem.EmbeddedControllerMajorVersion & @CRLF
      $Output = $Output & "EmbeddedControllerMinorVersion: " & $objItem.EmbeddedControllerMinorVersion & @CRLF
      $Output = $Output & "IdentificationCode: " & $objItem.IdentificationCode & @CRLF
      $Output = $Output & "InstallableLanguages: " & $objItem.InstallableLanguages & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LanguageEdition: " & $objItem.LanguageEdition & @CRLF
      $strListOfLanguages = $objItem.ListOfLanguages(0)
      $Output = $Output & "ListOfLanguages: " & $strListOfLanguages & @CRLF
      $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "OtherTargetOS: " & $objItem.OtherTargetOS & @CRLF
      $Output = $Output & "PrimaryBIOS: " & $objItem.PrimaryBIOS & @CRLF
      $Output = $Output & "ReleaseDate: " & WMIDateStringToDate($objItem.ReleaseDate) & @CRLF
      $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF
      $Output = $Output & "SMBIOSBIOSVersion: " & $objItem.SMBIOSBIOSVersion & @CRLF
      $Output = $Output & "SMBIOSMajorVersion: " & $objItem.SMBIOSMajorVersion & @CRLF
      $Output = $Output & "SMBIOSMinorVersion: " & $objItem.SMBIOSMinorVersion & @CRLF
      $Output = $Output & "SMBIOSPresent: " & $objItem.SMBIOSPresent & @CRLF
      $Output = $Output & "SoftwareElementID: " & $objItem.SoftwareElementID & @CRLF
      $Output = $Output & "SoftwareElementState: " & $objItem.SoftwareElementState & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "SystemBiosMajorVersion: " & $objItem.SystemBiosMajorVersion & @CRLF
      $Output = $Output & "SystemBiosMinorVersion: " & $objItem.SystemBiosMinorVersion & @CRLF
      $Output = $Output & "TargetOperatingSystem: " & $objItem.TargetOperatingSystem & @CRLF
      $Output = $Output & "Version: " & $objItem.Version & @CRLF
      ;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      GUICtrlSetData ($edt, $Output)
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_BIOS" )
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

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $CopyButton
    EndSwitch
WEnd

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...