(view source code of checkres.vbs as plain text)
Option Explicit
Dim intBpp, intHor, intRC, intVert
Dim colItems, objItem, objWMIService
Dim strQuery
intRC = 0
intBpp = 0
intHor = 0
intVert = 0
With WScript.Arguments.Unnamed
If .Count = 2 Or .Count = 3 Then
If IsNumeric( .Item(0) ) Then
intHor = CInt( .Item(0) )
Else
Syntax
End If
If IsNumeric( .Item(1) ) Then
intVert = CInt( .Item(1) )
Else
Syntax
End If
If .Count = 3 Then
If IsNumeric( .Item(2) ) Then
intBpp = CInt( .Item(2) )
Else
Syntax
End If
End If
Else
Syntax
End If
End With
strQuery = "SELECT * FROM Win32_DisplayConfiguration"
Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
Set colItems = objWMIService.ExecQuery( strQuery, "WQL", 48 )
For Each objItem In colItems
If objItem.PelsWidth < intHor Then intRC = 1
If objItem.PelsHeight < intVert Then intRC = 1
If objItem.BitsPerPel < intBpp Then intRC = 1
Next
Set colItems = Nothing
Set objWMIService = Nothing
WScript.Quit intRC
Sub Syntax
With WScript
.Echo "CheckRes.vbs, Version 1.01" _
& vbCrLf _
& "Check if the screen resolution meets your minimum requirements" _
& vbCrLf & vbCrLf _
& "Usage: CSCRIPT //NoLogo CHECKRES.VBS min_hor min_vert [ min_bpp ]" _
& vbCrLf & vbCrLf _
& "Where: ""min_hor"" is the minimum required horizontal resolution in pixels" _
& vbCrLf _
& " ""min_vert"" is the minimum required vertical resolution in pixels" _
& vbCrLf _
& " ""min_bpp"" is the minimum required number of bits per pixel" _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _
& "http://www.robvanderwoude.com"
.Quit 2
End With
End Sub
page last modified: 2024-04-16; loaded in 0.0270 seconds