Jump to content

Recommended Posts

  • Moderators
Posted

@leomoon Whenever you are dealing with WMI classes, the AutoIt Script-O-Matic tool is invaluable

Not only does it give you a nice GUI for browsing through the different classes, it shows you example AutoIt code for interacting with that class:

WMIPNG.PNG.f2f314713c3d9d93811779bd92d8adf1.PNG

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

This is another option:

#include <Constants.au3>
$DSK = Run('cmd', '', @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
    Do
        $Read = StdoutRead($DSK, True, False)
        $Str = StringInStr($Read, 'Microsoft Windows')
    Until $Str <> 0
    StdinWrite($DSK, "wmic cpu get name" & @CRLF)
    Do
        $Read = StdoutRead($DSK, True, False)
        $Str1 = StringInStr($Read, 'Name', 0, 1)
    Until $Str1 <> 0
    Sleep(500)
    $Read = StdoutRead($DSK, True, False)
    $Spl = StringSplit($Read, 'Name', 1)
    If $Spl <> @error Then
        $SplR2 = StringLeft($Spl[2], StringInStr($Spl[2], @CRLF, 0, -1))
        $SplR2 = StringStripWS($SplR2, 7)
    Else
        $SplR2 = 'NULL'
    EndIf
    StdioClose($DSK)
    MsgBox(64, 'Information',  $SplR2 )

 

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
×
×
  • Create New...