Jump to content

Recommended Posts

I got a stuck, iam trying to make a programme for my work that checks the software version and if the version is oke there should be a "V" instead of a "X".

How could can i do that.

#include <GUIConstants.au3>
#NoTrayIcon


GUICreate("Pc Info", 500, 360)  ; will create a dialog box that when displayed is centered
;Cecklist;00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
$versie1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell", "CurrentVersion")
$versie2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600", "Version")
$versie3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VSEMAS850000", "Version")
$versie4 = FileGetVersion("C:\Programme\WinRAR\WinRAR.exe")
$versie5 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A8AD990E-355A-4413-8647-A9B168978423}_is1","DisplayVersion")
$versie6 = FileGetVersion("C:\Programme\Adobe\Acrobat 7.0\Reader\AcroRd32.exe")
$versie7 = FileGetVersion("C:\Programme\Baan\bin\becs.exe")
$versie8 = FileGetVersion("C:\Programme\Microsoft Office\OFFICE11\OUTLOOK.EXE")
$versie9 = FileGetVersion("C:\Programme\CCleaner\ccleaner.exe")
$versie10 = FileGetVersion("C:\Programme\FreePDF_XP\freepdf.exe")
$versie11 = FileGetVersion("C:\Programme\gs\gs8.51\bin\gswin32.exe")
$versie16 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000", "Version")
$versie17 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\ZENworks\ZfD\Agent", "Version")
;Cecklist;00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Dim $BIOS
Dim $Processors
_ComputerGetBIOS($BIOS)
_ComputerGetProcessors($Processors)

If @error Then
    $error = @error
    $extended = @extended
    Switch $extended
        Case 1
            _ErrorMsg("Array contains no information.")
        Case 2
            _ErrorMsg("$colItems isnt an object.")
    EndSwitch
EndIf

For $i = 1 To $BIOS[0][0] Step 1
GUICtrlCreateLabel ("Computernaam:  "& @ComputerName,  10, 5, 300)
GUICtrlCreateLabel ("Bios Versie:   " & $BIOS[$i][0],  10, 17, 300)
GUICtrlCreateLabel ("CPU:       " & $Processors[$i][0],  10, 29, 300)
GUICtrlCreateLabel ("Aantal CPU's:  " & $Processors[$i][7],  10, 41, 300)
GUICtrlCreateLabel ("Snelheid:  " & $Processors[$i][9],  10, 53, 300)
GUICtrlCreateLabel ("Chassis Type:  " & _ChassisType(),  10, 65, 300)


GUICtrlCreateLabel ("----------------------------------------------------------------------------------------------------------------------------------------------------------------------", 1, 110,700)
$Button_updateall = GuiCtrlCreateButton   ("Update Software", 1, 90)
GUICtrlCreateLabel ("Software       PC        Actuele Versie        Computer Versie", 10 , 123, 700)

GUICtrlCreateLabel ("----------------------------------------------------------------------------------------------------------------------------------------------------------------------", 1, 135,700)
GUICtrlCreateLabel ("Novell Client      X        4.91"&"            "&$versie1, 10 , 145, 700)
GUICtrlCreateLabel ("Mcafee         X        8.5.0.781"&"       "&$versie2, 10 , 160, 700)
GUICtrlCreateLabel ("Mcafee Antispyware X        8.5.0.163" &"      "&$versie3, 10 , 175, 700)
GUICtrlCreateLabel ("WinRAR     X        3.42.0.0" &"       "&$versie4, 10 , 190, 700)
GUICtrlCreateLabel ("UltraVNC       X        1.1.0.2" &"            "&$versie5, 10 , 205, 700)
GUICtrlCreateLabel ("AdobeReader        X        7.0.8.218" &"      "&$versie6, 10 , 220, 700)
GUICtrlCreateLabel ("Baan           X        B40c.81 - (6.1.3.82)" &"   "&$versie7, 10 , 235, 700)
GUICtrlCreateLabel ("Ghostscript        X        851            "&$versie11, 10 , 250, 700)
GUICtrlCreateLabel ("FreePDF        X        3.7.0.2" &"            "&$versie10, 10 , 265, 700)
GUICtrlCreateLabel ("CCleaner       X        1.34           "&$versie9, 10 , 280, 700)
GUICtrlCreateLabel ("Office         X        2003"&" - ("&$versie8&")"&"    "&$versie8, 10 , 295, 700)
GUICtrlCreateLabel ("ePolicy Client     X        3.6.0.453" &"      "&$versie16, 10 , 310, 700)
GUICtrlCreateLabel ("Zenworks       X        7.0.100.60706" &"      "&$versie17, 10 , 325, 700)
GUICtrlCreateLabel ("----------------------------------------------------------------------------------------------------------------------------------------------------------------------",  1,350,700)


GUISetState (@SW_SHOW)


                                    

Next

Func _ErrorMsg($message, $time = 0)
    MsgBox(48 + 262144, "Error!", $message, $time)
EndFunc

Func _ComputerGetBIOS(ByRef $aBIOSInfo)
    Local $cI_Compname = @ComputerName, $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems, $objWMIService, $objItem
    Dim $aBIOSInfo[1][25], $i = 1
    
    $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            ReDim $aBIOSInfo[UBound($aBIOSInfo) + 1][25]
            $aBIOSInfo[$i][0]  = $objItem.Name
            
            $i += 1
        Next
        $aBIOSInfo[0][0] = UBound($aBIOSInfo) - 1
        If $aBIOSInfo[0][0] < 1 Then
            SetError(1, 1, 0)
        EndIf
    Else
        SetError(1, 2, 0)
    EndIf
EndFunc ;_ComputerGetBIOS
Func _ComputerGetProcessors(ByRef $aProcessorInfo)
    Local $cI_Compname = @ComputerName, $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems, $objWMIService, $objItem
    Dim $aProcessorInfo[1][42], $i = 1
    
    $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            ReDim $aProcessorInfo[UBound($aProcessorInfo) + 1][42]
            $aProcessorInfo[$i][0]  = StringStripWS($objItem.Name, 1)
            $aProcessorInfo[$i][9]  = $objItem.CurrentClockSpeed
            $aProcessorInfo[$i][8]  = $objItem.CreationClassName
            $aProcessorInfo[$i][7]  = $objItem.CpuStatus

        Next
        $aProcessorInfo[0][0] = UBound($aProcessorInfo) - 1
        If $aProcessorInfo[0][0] < 1 Then
            SetError(1, 1, 0)
        EndIf
    Else
        SetError(1, 2, 0)
    EndIf
EndFunc ;_ComputerGetProcessors
Func _ChassisType($strComputer = "localhost")
    Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems = "", $objItem, $objWMIService
    Local $ChassisType[25] = [24, 'Other', 'Unknown', 'Desktop', 'Low Profile Desktop', 'Pizza Box', 'Mini Tower', _
            'Tower', 'Portable', 'Laptop', 'Notebook', 'Hand Held', 'Docking Station', 'All in One', _
            'Sub Notebook', 'Space-Saving', 'Lunch Box', 'Main System Chassis', 'Expansion Chassis', _
            'SubChassis', 'Bus Expansion Chassis', 'Peripheral Chassis', 'Storage Chassis', _
            'Rack Mount Chassis', 'Sealed-Case PC']
    
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_SystemEnclosure", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            $strChassisTypes = $objItem.ChassisTypes (0)
            Return $ChassisType[$strChassisTypes] & @LF
        Next
    EndIf
    Return
EndFunc 
While 1
    $msg = GUIGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    


    Case $msg = $Button_updateall
MsgBox(0, "", "hoi")
    EndSelect
Wend
Link to comment
Share on other sites

Maybe ...

If $versie1 = "4.91" Then
    GUICtrlCreateLabel ("Novell Client    V   4.91"&"   "&$versie1, 10 , 145, 700)
Else
    GUICtrlCreateLabel ("Novell Client    X   4.91"&"   "&$versie1, 10 , 145, 700)
EndIf

?

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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...