Boa tarde pessoal!
Como sou um tanto quanto perfeccionista, sempre me encomodou um background 1024X768 aplicado em um monitor FULL HD - 1920-1080.
Depois de muito pesquisar e nunca encontrar um script que fizesse isso, decidi me "meter" a fazer um que fosse funcional.
Gostaria de compartilhar meu Script, que faz a validação da resolução e aplica o plano de fundo do tamanho certo.
Sei que não é "perfeito" mas me resolveu o problema :P
Option Explicit
Dim strComputer, objWMIService, colItems, objItem
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject("winmgmts:\\localhost\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'Exibe resolução na tela
'WScript.Echo "ScreenWidth: " & objItem.ScreenWidth
'WScript.Echo "ScreenHeight: " & objItem.ScreenHeight
Dim objShell
if objItem.ScreenWidth = "1280" then
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "\\10.200.52.1\Bginfo\1024.vbs"
Set objShell = Nothing
elseif objItem.ScreenWidth = "1366" then
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "\\10.200.52.1\Bginfo\1440.vbs"
Set objShell = Nothing
elseif objItem.ScreenWidth = "1440" then
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "\\10.200.52.1\Bginfo\1920.vbs"
Set objShell = Nothing
elseif objItem.ScreenWidth = "1600" then
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "\\10.200.52.1\Bginfo\1920.vbs"
Set objShell = Nothing
elseif objItem.ScreenWidth = "1920" then
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "\\10.200.52.1\Bginfo\1920.vbs"
Set objShell = Nothing
end if
Next
Function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) _
& ":" & Mid(dtmDate,13, 2))
End Function
Dependendo da resolução, aplico um config do BGInfo com:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "\\10.200.52.1\BGinfo\Bginfo.exe \\10.200.52.1\BGinfo\1024.bgi /silent /NOLICPROMPT /timer:0"
Espero que seja util para mais alguém que seja perfeccionista como eu!
Se útil, classifique!
Abs!
Glauco Malagoli