Jump to content

Recommended Posts

Posted

hi all ^^

I'm now working 3 or 4 days with Autoit, I have created a program that read which windows you have, build, servicepack, computername, Windows product key, office product key, Processor(doesn't find my Q8300 OC(i'm using Windows Vista Business x64), graphicscard(only if driver is installed), soundcard(only if driver is installed).

Can you guys help me with the part of the Processor, graphicscard and soundcard, that the program checks the DEV and VEN numbers and write them down.

The product key for your windows i had tested @ a Windows XP x86 computer and a Windows Vista Business x64 computer. The product key for office works with 2003(not tested on other versions).

Pls help me to improve this script.

system_information.au3

hardware.au3

decode.au3

Posted

Hi,

search for WinInformation on the forum and from ComputerInformation UDF in Example Scripts.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

Hi,

search for WinInformation on the forum and from ComputerInformation UDF in Example Scripts.

Mega

and what about the scripting is it good or must i change a few things?

Posted

The code seems ok, but you needn't to do it again. I think everything you want has been done before.

Or have a look at siw.exe

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

Can someone tell me how to get in a button for printing. I don't know how and i don't any good posts for it (and i don't know how to get it in).

Maybe

#Include <File.au3>
_FilePrint($s_File[, $i_Show = @SW_HIDE])

if you dont have this in file you can use FileWriteLine or something like this to create your .txt with PC informations :)

Or maybe... use

Run(DxDiag) ans save log :) but i think Dx doesnt exist on other systems than Windows

This world is crazy

Posted

Maybe

#Include <File.au3>
_FilePrint($s_File[, $i_Show = @SW_HIDE])

if you dont have this in file you can use FileWriteLine or something like this to create your .txt with PC informations :)

Or maybe... use

Run(DxDiag) ans save log :) but i think Dx doesnt exist on other systems than Windows

didn't worked.

I'm now started with send it to notepad, but it don't work, if i place the variables(functions) for the Motherboard, CPU, Graphics and Sound.

If i try to put the functions in the send line, they will give me a 0(zero)

here is my new file, the functions are in the files on the top of this post

system_information.au3

Posted

can someone help me with it?

the error i get in SciTE4:

C:\Program Files\AutoIt3\Include\hardware.au3 (3) : ==> Variable must be of type "Object".:

$colItems = $objWMIService.ExecQuery("Select * from Win32_baseboard")

$colItems = $objWMIService^ ERROR

>Exit code: 1 Time: 0.413

how to get rid of it?

Posted

Nutz doch mal

#include<GUIConstantsEx.au3>
#include<WindowsConstants.au3>
; AutoIt ScriptOMatic
; -------------------
;
; AutoIt's counterpart of Microsoft's Scriptomatic
;
; Author:       SvenP
; Date/version: 2005-04-17
; See also:     http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx
; Requires:     AutoIt beta version 3.1.1.8 or higher (COM support!!)
;
; GUI generated by AutoBuilder 0.5 Prototype


;************************
;* Global State Variables
;************************
$g_strCurrentNamespace  = "\root\CIMV2"
$g_iCurrentNamespaceIndex = 0
$g_strWMISource     = "localhost"
$g_strOutputFormat  = "Dialog"

;************************
;* Main GUI
;************************

GuiCreate("AutoIt Scriptomatic Tool", 684, 561,(@DesktopWidth-684)/2, (@DesktopHeight-561)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUI_AST_MainGroup  = GuiCtrlCreateGroup("",    10, 10,660,530)
$GUI_WMI_NamespaceLabel = GuiCtrlCreateLabel("WMI Namespace", 20, 30,150, 20)
$GUI_WMI_Namespace  = GuiCtrlCreateCombo("WMI_Namespaces", 20, 50,280, 80)
$GUI_WMI_ClassLabel     = GuiCtrlCreateLabel("WMI Class",   320, 30,240, 20)
$GUI_WMI_Classes    = GuiCtrlCreateCombo("WMI_Classes", 320, 50,340, 80)
$GUI_AST_ButtonGroup    = GuiCtrlCreateGroup("",    10, 80,660, 50)
$GUI_AST_Run    = GuiCtrlCreateButton("Run",    20,100, 50, 20)
$GUI_AST_CIMv2  = GuiCtrlCreateButton("CIMv2",  80,100, 50, 20)
$GUI_AST_WMISource  = GuiCtrlCreateButton("WMISource",  140,100, 70, 20)
$GUI_AST_Open   = GuiCtrlCreateButton("Open",   220,100, 60, 20)
$GUI_AST_Save   = GuiCtrlCreateButton("Save",   290,100, 60, 20)
$GUI_AST_Quit   = GuiCtrlCreateButton("Quit",   360,100, 60, 20)
$GUI_AST_OptionGroup     = GuiCtrlCreateGroup("Output",     430, 80,240, 50)
$GUI_AST_RadioDialog     = GuiCtrlCreateRadio("Dialog",     440,100, 50, 20)
$GUI_AST_RadioText       = GuiCtrlCreateRadio("Text",   510,100, 50, 20)
$GUI_AST_RadioHTML       = GuiCtrlCreateRadio("HTML",   570,100, 50, 20)
$GUI_AST_ScriptCode     = GuiCtrlCreateEdit("One moment...", 20,140,640,390)

GuiSetState()

; Initial GUI Settings
GUICtrlSetState($GUI_AST_RUN,       $GUI_DISABLE)
GUICtrlSetState($GUI_AST_SAVE,      $GUI_DISABLE)
GUICtrlSetState($GUI_AST_RadioDialog,$GUI_CHECKED) 

; Fill the WMI_Namespaces Combobox
LoadWMINamespaces()

; Fill the WMI_Classes Combobox
HandleNamespaceChange()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $GUI_AST_QUIT
        ExitLoop
    Case $msg = $GUI_WMI_Namespace
        HandleNameSpaceChange()
    Case $msg = $GUI_WMI_Classes
        ComposeCode()
    Case $msg = $GUI_AST_Run        
        RunScript()
    Case $msg = $GUI_AST_Save
        SaveScript()
    Case $msg = $GUI_AST_Open
        OpenScript()
    Case $msg = $GUI_AST_CIMv2      
        SetNamespaceToCIMV2()
    Case $msg = $GUI_AST_WMISource      
        SetWMIRepository()      
    Case $msg = $GUI_AST_RadioDialog or _
         $msg = $GUI_AST_RadioText or _ 
         $msg = $GUI_AST_RadioHTML
        HandleOutputChange()
    EndSelect
WEnd

GUIDelete()

Exit

;********************************************************************
;* LoadWMINamespaces
;********************************************************************
Func LoadWMINamespaces()
 $strCsvListOfNamespaces = ""
 $strNameSpacesCombo=""

 $strWaitNamespaces="Please wait, Loading WMI Namespaces"
 GUICtrlSetData($GUI_WMI_Namespace,$strWaitNamespaces,$strWaitNamespaces)
 
 EnumNameSpaces("root", $strCsvListOfNamespaces)

 $arrNamespaces = StringSplit($strCsvListOfNamespaces, ",")

 For $strNamespace in $arrNamespaces
    $strNameSpacesCombo = $strNameSpacesCombo & "|" & $strNamespace
 Next

 GUICtrlSetData($GUI_WMI_Namespace,$strNameSpacesCombo,"ROOT\CIMV2")

EndFunc

;********************************************************************
;* EnumNamespaces
;********************************************************************
Func EnumNamespaces($strNamespace, ByRef $tmpCsvListOfNamespaces)

    If $tmpCsvListOfNamespaces = "" Then
        $tmpCsvListOfNamespaces = $strNamespace
    Else
        $tmpCsvListOfNamespaces = $tmpCsvListOfNamespaces & "," & $strNamespace
    EndIf

    $strComputer = $g_strWMISource
    $objWMIService = ObjGet("winmgmts:\\" & $g_strWMISource & "\" & $strNameSpace)
 
    If not @error Then
     
        $colNameSpaces = $objWMIService.InstancesOf("__NAMESPACE")

        For $objNameSpace In $colNameSpaces
            EnumNamespaces($strNameSpace & "\" & $objNameSpace.Name, $tmpCsvListOfNamespaces)
        Next
    Else
        $tmpCsvListOfNamespaces=""
    EndIf

EndFunc

;********************************************************************
;* HandleNamespaceChange
;********************************************************************
Func HandleNamespaceChange()

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 ; Clear the WMI classes pulldown location.
 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 $strSelectedNamespace = GUICtrlRead ( $GUI_WMI_Namespace )
    
 ; Disable the namespace combobox until class load has been completed
 GUICtrlSetState($GUI_WMI_Namespace, $GUI_DISABLE)
 
 $strWMIWaitMsg = "Please wait, trying to load WMI Classes in namespace " & $strSelectedNamespace
 GUICtrlSetData($GUI_WMI_Classes, $strWMIWaitMsg, $strWMIWaitMsg)
 GUICtrlSetData($GUI_AST_ScriptCode,"One moment...","")
 
 LoadWMIClasses()
 $g_strCurrentNamespace = "\" & $strSelectedNamespace
 
 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 ; Clear the code textarea and disable run and save.
 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 GUICtrlSetData($GUI_AST_ScriptCode,"","")
 
 GUICtrlSetState($GUI_WMI_Namespace, $GUI_ENABLE)
 GUICtrlSetState($GUI_AST_RUN, $GUI_DISABLE)
 GUICtrlSetState($GUI_AST_SAVE, $GUI_DISABLE)

EndFunc

;********************************************************************
;* LoadWMIClasses
;*
;* Fetch all the classes in the currently selected namespace, and
;* populate the keys of a dictionary object with the names of all
;* dynamic (non-association) classes. Then we transfer the keys to
;* an array, sort the array, and finally use the sorted array to
;* populate the WMI classes pulldown.
;********************************************************************
Func LoadWMIClasses()

    Const $SORT_KEYS = 1
    Const $SORT_ITEMS = 2

    $objClassDictionary     = ObjCreate("Scripting.Dictionary")
    $objQualifierDictionary = ObjCreate("Scripting.Dictionary")

    $strComputer = "."
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & $g_strCurrentNamespace)

    If not @error Then
     
        For $objClass in $objWMIService.SubclassesOf()

            For $objQualifier In $objClass.Qualifiers_()    ; Dummy (), because it ends with an underscore !
                $objQualifierDictionary.Add(StringLower($objQualifier.Name), "")
            Next

            If $objQualifierDictionary.Exists("dynamic") Then
     
                ;$TempVar = $objClass.Path_.Class
                ;$objClassDictionary.Add($TempVar, "")  ; Can't use object in arguments ?!!

                $objClassDictionary.Add($objClass.Path_.Class, "")

            EndIf

            $objQualifierDictionary.RemoveAll

        Next

        $objQualifierDictionary = ""

        ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        ; If the current namespace contains dynamic classes...
        ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        If $objClassDictionary.Count Then

            ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            ; Sort the dictionary.
            ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            SortDictionary($objClassDictionary, $SORT_KEYS)

            ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            ; Populate the WMI classes pulldown with the sorted dictionary.
            ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
     
            $strClassesCombo="|Select a WMI class" 
     
            For $strWMIClass in $objClassDictionary ; method .Keys is not an object ??
                $strClassesCombo = $strClassesCombo & "|" & $strWMIClass
            Next
    
            GUICtrlSetData($GUI_WMI_Classes,$strClassesCombo,"Select a WMI class")

        EndIf
    EndIf
    
    If @error Or $objClassDictionary.Count = 0 Then
    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ; And if the current namespace doesn't contain dynamic classes.
    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
     GUICtrlSetData($GUI_WMI_Classes,"|No dynamic classes found in current namespace.|Select a different namespace","")
     
    EndIf

 $objClassDictionary = ""

EndFunc

;********************************************************************
;* SortDictionary
;* 
;* Shell sort based on:
;* http://support.microsoft.com/support/kb/articles/q246/0/67.asp
;********************************************************************
Func SortDictionary(ByRef $objDict, $intSort)

 Const $dictKey = 1
 Const $dictItem = 2

 Dim $strDict[1][3]

 $intCount = $objDict.Count

 If $intCount > 1 Then

    ReDim $strDict[$intCount][3]

    $i = 0
    For $objKey In $objDict

         $strDict[$i][$dictKey] = String($objKey)
    $strDict[$i][$dictItem] = String($objDict($objKey))
         
    $i = $i + 1
    Next

    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ; Perform a shell sort of the 2D string array
    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    For $i = 0 To ($intCount - 2)
    For $j = $i To ($intCount - 1)
    If $strDict[$i][$intSort] > $strDict[$j][$intSort] Then
    $strKey = $strDict[$i][$dictKey]
    $strItem = $strDict[$i][$dictItem]
    $strDict[$i][$dictKey] = $strDict[$j][$dictKey]
    $strDict[$i][$dictItem] = $strDict[$j][$dictItem]
    $strDict[$j][$dictKey] = $strKey
    $strDict[$j][$dictItem] = $strItem
    EndIf
    Next
    Next

    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ; Erase the contents of the dictionary object
    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    $objDict.RemoveAll

    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ; Repopulate the dictionary with the sorted information
    ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    For $i = 0 To ($intCount - 1)
    $objDict.Add($strDict[$i][$dictKey], $strDict[$i][$dictItem])
    Next

 EndIf

EndFunc

;********************************************************************
;* ComposeCode
;********************************************************************
Func ComposeCode()
    
    $objClass=""
    
    $strSelectedClass = GUICtrlRead ( $GUI_WMI_Classes )
    ; Check if a valid class has been selected
    If $strSelectedClass <> "Select a WMI class" Then

        $bHasDates = false ; Flag: output has date fields
        $strHeaderStart=Chr(34)
        $strRowStart=Chr(34)
        $strColumnSeparator=": "
        $strRowEnd=" & @CRLF"

 
        $strComputerCommand = "$strComputer = " & Chr(34) & $g_strWMISource & Chr(34)

        $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @COMPUTERNAME & $g_strCurrentNamespace)
        $objClass = $objWMIService.Get($strSelectedClass)

        If IsObj($objClass) Then
            
            $strScriptCode = ""
            $strScriptCode = $strScriptCode & "; Generated by AutoIt Scriptomatic" & @CRLF & @CRLF
            $strScriptCode = $strScriptCode & "$wbemFlagReturnImmediately = 0x10" & @CRLF
            $strScriptCode = $strScriptCode & "$wbemFlagForwardOnly = 0x20" & @CRLF
            $strScriptCode = $strScriptCode & '$colItems = ""' & @CRLF
            $strScriptCode = $strScriptCode & $strComputerCommand & @CRLF & @CRLF
            $strScriptCode = $strScriptCode & '$Output=""' & @CRLF
            
            If $g_strOutputFormat = "HTML" then
            $strScriptCode      = $strScriptCode & "$Output = $Output & '<html><head><title>Scriptomatic HTML Output</title></head><body> " & _
                                    "<style>table {font-size: 10pt; font-family: arial;} th {background-color: buttonface; font-decoration: bold;} " & _
                                    "</style><table BORDER=" & Chr(34) & "1" & Chr(34) & "><tr><th>Property</th><th>Value</th></tr>'" & @CRLF
                $strRowStart        = Chr(34) & "<tr><td>"
                $strHeaderStart     = "'<tr bgcolor=" & Chr(34) & "yellow" & Chr(34) & "><td>' & " & Chr(34)
                $strColumnSeparator = "</td><td>&nbsp;"
                $strRowEnd          = " & " & Chr(34) & "</td></tr>" & Chr(34) & " & @CRLF"
            EndIf
                     
            
            $strScriptCode = $strScriptCode & "$Output = $Output & " & $strHeaderStart & "Computer" & $strColumnSeparator & Chr(34) & " & $strComputer " & $strRowEnd & @CRLF
            
            If $g_strOutputFormat = "Dialog" then
                $strScriptCode = $strScriptCode & "$Output = $Output & " & Chr(34) & "==========================================" & Chr(34) & $strRowEnd & @CRLF
            EndIf
            
            $strScriptCode = $strScriptCode & "$objWMIService = ObjGet(" & Chr(34) & "winmgmts:\\" & Chr(34) & " & $strComputer & " & Chr(34) & $g_strCurrentNamespace & Chr(34) & ")" & @CRLF 
            $strScriptCode = $strScriptCode & "$colItems = $objWMIService.ExecQuery(" & Chr(34) & "SELECT * FROM " & $strSelectedClass & Chr(34) & ", " & Chr(34) & "WQL" & Chr(34) & ", _" & @CRLF
            $strScriptCode = $strScriptCode & "     $wbemFlagReturnImmediately + $wbemFlagForwardOnly)" & @CRLF & @CRLF
            $strScriptCode = $strScriptCode & "If IsObj($colItems) then" & @CRLF
            $strScriptCode = $strScriptCode & " For $objItem In $colItems" & @CRLF
 
            For $objProperty in $objClass.Properties_() ; Must use (), because method ends with an underscore
 
                If $objProperty.IsArray = True Then
                        $strScriptCode = $strScriptCode & "     $str" & $objProperty.Name & " = $objItem." & $objProperty.Name & "(0)" & @CRLF
                    $strScriptCode = $strScriptCode & "     $Output = $Output & " & $strRowStart & $objProperty.Name & $strColumnSeparator & Chr(34) & " & $str" & $objProperty.Name & $strRowEnd & @CRLF
                ElseIf $objProperty.CIMTYPE = 101 Then
                    $bHasDates = True
                    $strScriptCode = $strScriptCode & "     $Output = $Output & " & $strRowStart & $objProperty.Name & $strColumnSeparator & Chr(34) & " & WMIDateStringToDate($objItem." & $objProperty.Name & ")" & $strRowEnd & @CRLF
                Else
                    $strScriptCode = $strScriptCode & "     $Output = $Output & " & $strRowStart & $objProperty.Name & $strColumnSeparator & Chr(34) & " & $objItem." & $objProperty.Name & $strRowEnd & @CRLF
                EndIf
            Next
            
            If $g_strOutputFormat = "Dialog" then
                $strScriptCode = $strScriptCode & '     if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop' & @CRLF
                $strScriptCode = $strScriptCode & '     $Output=""' & @CRLF
            Endif
            $strScriptCode = $strScriptCode     & " Next" & @CRLF
            
            if $g_strOutputFormat = "Text" then
                $strScriptCode = $strScriptCode & ' ConsoleWrite($Output)' & @CRLF
                $strScriptCode = $strScriptCode & ' FileWrite(@TempDir & "\' & $strSelectedClass & '.TXT", $Output )' & @CRLF
                $strScriptCode = $strScriptCode & ' Run(@Comspec & " /c start " & @TempDir & "\' & $strSelectedClass & '.TXT" )' & @CRLF
            Elseif $g_strOutputFormat = "HTML" then
                $strScriptCode = $strScriptCode & ' FileWrite(@TempDir & "\' & $strSelectedClass & '.HTML", $Output )' & @CRLF
                $strScriptCode = $strScriptCode & ' Run(@Comspec & " /c start " & @TempDir & "\' & $strSelectedClass & '.HTML" )' & @CRLF 
            Endif           
            
            $strScriptCode = $strScriptCode & "Else" & @CRLF
            $strScriptCode = $strScriptCode & ' Msgbox(0,"WMI Output","No WMI Objects Found for class: " & ' & Chr(34) & $strSelectedClass & Chr(34) & ' )' & @CRLF
                
            $strScriptCode = $strScriptCode & "Endif" & @CRLF
            $strScriptCode = $strScriptCode & @CRLF & @CRLF
 
            If $bHasDates Then
                $strScriptCode = $strScriptCode & "Func WMIDateStringToDate($dtmDate)" & @CRLF
                $strScriptCode = $strScriptCode & @CRLF
                $strScriptCode = $strScriptCode & Chr(9) & "Return (StringMid($dtmDate, 5, 2) & ""/"" & _" & @CRLF
                $strScriptCode = $strScriptCode & Chr(9) & "StringMid($dtmDate, 7, 2) & ""/"" & StringLeft($dtmDate, 4) _" & @CRLF
                $strScriptCode = $strScriptCode & Chr(9) & "& "" "" & StringMid($dtmDate, 9, 2) & "":"" & StringMid($dtmDate, 11, 2) & "":"" & StringMid($dtmDate,13, 2))" & @CRLF
                $strScriptCode = $strScriptCode & "EndFunc"
            EndIf
        Else
            $strScriptCode = "Error: No Class properties found for " & $g_strCurrentNamespace & "\" & $strSelectedClass
        EndIf
        
        GUICtrlSetData($GUI_AST_ScriptCode,$strScriptCode)

        ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        ; Once the code is successfully composed and put into the
        ; textarea, ensure that the run and save buttons are enabled.
        ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        GUICtrlSetState($GUI_AST_RUN, $GUI_ENABLE)
        GUICtrlSetState($GUI_AST_SAVE, $GUI_ENABLE)     
        
    Else
        ; Disable Run and Save buttons, because no valid code has been generated
        GUICtrlSetState($GUI_AST_RUN, $GUI_DISABLE)
        GUICtrlSetState($GUI_AST_SAVE, $GUI_DISABLE)
    EndIf
    
EndFunc


;********************************************************************
;* RunScript
;********************************************************************
Func RunScript()

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 ; Create a temporary script file named "temp_script.au3".
 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 $strTmpName = @TempDir & "\temp_script.au3"
 
 if FileExists($strTmpName) then FileDelete($strTmpName)

 FileWrite($strTmpName,GUICtrlRead($GUI_AST_Scriptcode))

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 ; Start constructing the command line that will run the script...
 ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 $strCmdLine = @AutoItExe & " " & $strTmpName
 
 RunWait($strCmdLine)

 FileDelete($strTmpName)
 
EndFunc


;********************************************************************
;* SaveScript
;********************************************************************
Func SaveScript()
     
 $strTmpName=FileSaveDialog("Save Script",@DesktopDir,"AutoIt3 Scripts (*.au3)",16, GUICtrlRead ( $GUI_WMI_Classes ))
 
 if not @error and $strTmpName <> "" then
        if StringRight($strTmpName,4) <> ".AU3" then $strTmpName=$strTmpName & ".AU3"
        if FileExists($strTmpName) then FileDelete($strTmpName)
        FileWrite($strTmpName,GUICtrlRead($GUI_AST_Scriptcode))
 EndIf
 
EndFunc


;********************************************************************
;* OpenScript
;********************************************************************

Func OpenScript()

 $strTmpName=FileOpenDialog("Open Script",@DesktopDir,"AutoIt3 Scripts (*.au3)")

 If not @error and $strTmpName <> "" then
    If FileExists($strTmpName) then
        GUICtrlSetData($GUI_AST_ScriptCode,FileRead($strTmpName,FileGetSize($strTmpName)))
    EndIf
 EndIf
 
EndFunc


;****************************************************************************
;* SetNamespaceToCIMV2
;****************************************************************************
Func SetNamespaceToCIMV2()
 If StringUpper(GUICtrlRead($GUI_WMI_Namespace)) <> "ROOT\CIMV2" Then
    GUICtrlSetData($GUI_WMI_Namespace,"ROOT\CIMV2","ROOT\CIMV2")
    HandleNamespaceChange()
 EndIf
EndFunc

;****************************************************************************
;* SetWMIRepository
;****************************************************************************
Func SetWMIRepository()

 $strWMISourceName = InputBox("Set WMI Repository Source", _
        "Please enter the computer whose WMI repository you want to read from: ", _
        $g_strWMISource)
 If $strWMISourceName <> "" Then
    
 $g_strWMISource = StringStripWS($strWMISourceName,1+2)
 ;target_computers.Value = $g_strWMISource
 LoadWMINamespaces()
 Endif
EndFunc

;****************************************************************************
;* HandleOutputChange
;****************************************************************************
Func HandleOutputChange()
    
    $ChosenFormat = $g_strOutputFormat
    if GUICtrlRead($GUI_AST_RadioDialog)=$GUI_CHECKED then $ChosenFormat="Dialog"
    if GUICtrlRead($GUI_AST_RadioText)=$GUI_CHECKED then $ChosenFormat="Text"
    if GUICtrlRead($GUI_AST_RadioHTML)=$GUI_CHECKED then $ChosenFormat="HTML"       
    if $ChosenFormat <> $g_strOutputFormat Then
        $g_strOutputFormat = $ChosenFormat
        ComposeCode()
    EndIf
EndFunc

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

  • 2 weeks later...
Posted (edited)

What does it now?

- See which Windows

- Architecture, build and servicepack

- Windows and Office productkey

- MOtherboard

- Processor

- Graphicscard (if the driver is installed)

- soundcard (if the driver is installed)

- Local IP

- External IP

- Printscreen

what has to come?

- Default gateway

- subnetmask

- Give the VEN and DEV ,if there is not a driver present for the sound- or graphicscard

I have noticed that when you have a OC CPU he don't read it, because it is empty then.

I tested it at home with my Q8300 which is OC from 2,5 GHz to 3,01 GHz

Edited by sander1991
Posted (edited)

Now the following question:P

I have found the command for getting the DEV and VEN.

for example:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.PNPDeviceID 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

The PNPDeviceID will display the following on the computer:

PCI\\VEN_8086DEV2772SUBSYS_27721849REV_02\311583659010

now i want to display VEN_8086&DEV2772 in the gui

how can i do this?

when a driver is present he must use:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.name 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

and when not:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.PNPDeviceID 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

Hopefully you guys can help me

Sander

Edited by sander1991
Posted

Now the following question:P

I have found the command for getting the DEV and VEN.

for example:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.PNPDeviceID 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

The PNPDeviceID will display the following on the computer:

PCI\\VEN_8086DEV2772SUBSYS_27721849REV_02\311583659010

now i want to display VEN_8086&DEV2772 in the gui

how can i do this?

when a driver is present he must use:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.name 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

and when not:

Func Read_Graphics() 
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

   For $objItem in $colItems      
    Local $item = $objItem.PNPDeviceID 
     GUICtrlCreateLabel($Item, 30, 320)        

  Next 
EndFunc

Hopefully you guys can help me

Sander

Hi,

since i get on 2 machines as PNPDeviceID

1)PCI\VEN_1002&DEV_94CC&SUBSYS_22561787&REV_00\5&C4AC401&0&0048F0

2)PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00\3&61AAA01&0&78

this work for me:

;Read_Graphics () ; outcomment, only to run test

Func Read_Graphics() 
    Local $colItems = ""
    ;$objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") ; outcomment, only to run test
    $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

    For $objItem in $colItems      
        If $objItem.name = "" Then 
            $item = StringMid ($objItem.PNPDeviceID, 5, 17)
        Else
            $item = $objItem.name
        EndIf
        GUICtrlCreateLabel($Item, 30, 320)
        ;ConsoleWrite ($Item) ; outcomment, only to run test
    Next 
EndFunc

;-))

Stefan

Posted

Hi,

since i get on 2 machines as PNPDeviceID

1)PCI\VEN_1002&DEV_94CC&SUBSYS_22561787&REV_00\5&C4AC401&0&0048F0

2)PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00\3&61AAA01&0&78

this work for me:

;Read_Graphics () ; outcomment, only to run test

Func Read_Graphics() 
    Local $colItems = ""
    ;$objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") ; outcomment, only to run test
    $colItems = $objWMIService.ExecQuery("Select * from Win32_VideoController")        

    For $objItem in $colItems      
        If $objItem.name = "" Then 
            $item = StringMid ($objItem.PNPDeviceID, 5, 17)
        Else
            $item = $objItem.name
        EndIf
        GUICtrlCreateLabel($Item, 30, 320)
        ;ConsoleWrite ($Item) ; outcomment, only to run test
    Next 
EndFunc

;-))

Stefan

THNX! i shall try it =)

Posted (edited)

it didn't worked for me, i deleted the installation of the device trew the device manager and i don't get a VEN or DEV number :s it is still empty

Maybe it's because i have a gui?

Edited by sander1991
Posted

maybe you can get it in my gui? it must be in functions.au3

pls test it as well

i think i'm doing something wrong

Hi,

if you remove the device, there might no device shown by WMI. You should test your script on a machine, where the graphics device driver isn't installed. You may also proof your WMI by scriptomatic.au3 (Search forum for it, very nice).

This shows you the result of WMI queries and is very helpful for debugging and control outputs.

;-))

Posted

Now the next question:P

If i close the gui the incoming.dat has to be deleted, it can't be done if the gui is still running because the file is in use then.

i tried filedelete("filename") but it doesn't work

Posted

Hi,

1) Have a look in helpfile: OnExitFunc

2) If you have a FileOpen for your incoming.dat you need a FileClose before FileDelete.

3) What you get as return from FileDelete. You should also test full path to file.

;-))

Stefan

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
  • Recently Browsing   0 members

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