Jump to content

Recommended Posts

Posted

I am writing a script that checks if firefox , notepad++ and java are installed .

The catch being that i need a GUI where it is written in, something like a Messagebox or something similar.

I am new to this so sry if i am asking dumb questions.

Posted
1 minute ago, Jos said:

Which question is that exactly, as there is none in your post?

Jos

sry i got sidetracked when i was typing ^^', i wanted to ask if I could get some help writing the script ?

thanks for the help in advance !

Posted (edited)
17 minutes ago, Jos said:

We are not helping for sure, but aren't writing it for you. ;)

So what have you tried already and what isn't working?

Jos

Well I don't know how to go about this but I can get .txt file to appear with all programs but i only want to check the 3 in a message box

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Caption: " & $objItem.Caption & @CRLF
      $Output &= "Description: " & $objItem.Description & @CRLF
      $Output &= "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
      $Output &= "InstallDate: " & $objItem.InstallDate & @CRLF
      $Output &= "InstallDate2: " & WMIDateStringToDate($objItem.InstallDate2) & @CRLF
      $Output &= "InstallLocation: " & $objItem.InstallLocation & @CRLF
      $Output &= "InstallState: " & $objItem.InstallState & @CRLF
      $Output &= "Name: " & $objItem.Name & @CRLF
      $Output &= "PackageCache: " & $objItem.PackageCache & @CRLF
      $Output &= "SKUNumber: " & $objItem.SKUNumber & @CRLF
      $Output &= "Vendor: " & $objItem.Vendor & @CRLF
      $Output &= "Version: " & $objItem.Version & @CRLF
   Next
   ConsoleWrite($Output)
   FileWrite(@TempDir & "\Win32_Product.TXT", $Output )
   Run(@Comspec & " /c start " & @TempDir & "\Win32_Product.TXT" )
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" )
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

 

Edited by Jos
Added codebox
  • Developers
Posted (edited)

So I guess you found this script somewhere and don't understand how it is working yet?

What about playing with it and adding some sort of If statement around the FileWrite()?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

yeah I was looking up some help but only found this , would you recommend i put a if statement in the if statement or  keep the Filewrite() out of the existing if statement ?

thanks for the help so far !😊

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