(view source code of dppeee.vbs as plain text)
Option Explicit
If WScript.Arguments.Count > 0 Then Syntax
Dim intXRes, intYRes
Dim colItems, objFSO, objItem, objWMIService, wshShell
Dim strDPPExec, strDPPPath
Set wshShell = CreateObject( "WScript.Shell" )
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
' Find the path to the DPP executable
strDPPPath = wshShell.RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Canon\DPP\InstallPath" )
strDPPExec = """" & objFSO.BuildPath( strDPPPath, "DPPViewer.exe" ) & """"
' Check the current screen resulution
Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
Set colItems = objWMIService.ExecQuery( "Select * from CIM_VideoController", , 48 )
For Each objItem in colItems
If Not IsNull( objItem.CurrentHorizontalResolution ) Then
intXRes = CInt( objItem.CurrentHorizontalResolution )
intYRes = CInt( objItem.CurrentVerticalResolution )
End If
Next
Set colItems = Nothing
Set objWMIService = Nothing
' Set the screen resolution to 1024x768 only if necessary
If Not IsNull( intXRes ) Then
If intXRes <> 1024 Or intYRes <> 768 Then
On Error Resume Next
wshShell.Run "SetRes.exe m0:0 h1024 v768", 6, True
If Err Then Syntax
On Error Goto 0
End If
End If
' Run the DPP program
wshShell.Run strDPPExec, 3, True
' Restore the original screen resolution if necessary
If Not IsNull( intXRes ) Then
If intXRes <> 1024 Or intYRes <> 768 Then
On Error Resume Next
wshShell.Run "SetRes.exe m0:0 h" & intXRes & " v" & intYRes, 6, False
On Error Goto 0
End If
End If
Set objFSO = Nothing
Set wshShell = Nothing
Sub Syntax
Dim strMsg
strMsg = vbCrLf _
& "DPPEEE.vbs, Version 1.11" _
& vbCrLf _
& "Temporarily change the screen resolution to 1024x768 on a netbook PC to allow" _
& vbCrLf _
& "running Canon Digital Photo Professional software." _
& vbCrLf & vbCrLf _
& "Usage: DPPEEE.VBS" _
& vbCrLf & vbCrLf _
& "Notes: Requires Ian Sharpe's SetRes (http://www.iansharpe.com/downloads.php)" _
& vbCrLf _
& " Script can easily be modified for other software requiring 1024x768." _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
page last modified: 2024-04-16; loaded in 0.0072 seconds