chrbb Posted December 5, 2008 Posted December 5, 2008 I'm trying to find an autoit script that I can compile for users to click to change their screen resolution to 800 x 600. We have just started using Abacus i planner which will only display full size at 800 x 600, which means that with our laptops it's actually quite difficult to read! Whilst most users are happy to change the resolution the standard way it would be easier to have a button to press:) Is it possible with autoit?
FN-GM Posted December 5, 2008 Posted December 5, 2008 I'm trying to find an autoit script that I can compile for users to click to change their screen resolution to 800 x 600. We have just started using Abacus i planner which will only display full size at 800 x 600, which means that with our laptops it's actually quite difficult to read! Whilst most users are happy to change the resolution the standard way it would be easier to have a button to press:) Is it possible with autoit? I have a batch file with a .exe to achieve this if your interested?
DrPerceptron Posted December 5, 2008 Posted December 5, 2008 We use QRes to do this for the students who ask for it. SourceForge.net: QRes - Windows screen mode changer
chrbb Posted December 5, 2008 Author Posted December 5, 2008 Thanks, qres is my fallback, I was hoping to use autoit as I use that for the proxy on/off for the staff laptops so just wanted to have a consistant look.
OutToLunch Posted December 5, 2008 Posted December 5, 2008 Dump qres in the \system32 folder on the machines and just use your AutoIT script to make a nice clicky button/gui to launch it with the right parameters?
chrbb Posted December 5, 2008 Author Posted December 5, 2008 I like that idea, not got enough brain cells to do it myself, can anyone lead me in the right way:o
mattx Posted December 5, 2008 Posted December 5, 2008 Use Vid res in a batch or call it: JD Design VidRes - Switch Video Resolution Utility EG: vidres /H1024 /V768 /c4294967296
plexer Posted December 5, 2008 Posted December 5, 2008 Plus vidres can switch the resolution, run the program you need, then switch it back after. Ben
plexer Posted December 5, 2008 Posted December 5, 2008 * Set the resolution to 640x480 while running an application: vidres /H640 /V480 "/Xc:\path\appname.exe" when appname.exe closes, the display will switch back to its original settings. * Set the resolution to 640x480 only while the specified application is the active maximized window: vidres /H640 /V480 "/Xc:\path\appname.exe" /R If you close appname.exe, run it non-minimized, or switch to a different window, the original resolution is restored. If you switch back to appname.exe the resolution will switch back again. 1
NeoPlosive Posted January 28, 2009 Posted January 28, 2009 Download Resolution Packages (.zip) | Alt Link Notes: - QRes Packages for 800x600, 1024x768 and 1440x900; - Individual packages just needs to be allocated out by allocation software or AD (CC3/CC4 compatible).
LeMarchand Posted January 29, 2009 Posted January 29, 2009 Does anyone know a way to get the resolution to automatically change dependant on whether an external monitor/projector is connected? I know that it's not much effort to make a couple of clicks, but these are teachers...
Arthur Posted February 9, 2009 Posted February 9, 2009 Here's how to do it using AutoIt. All you need to do is compile the script, create a shortcut to the EXE and than add the desired parameters to the end of the command-line. e.g. ChangeScreenRes.exe 1280 800 32 -1 #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Define variables $Width = $CmdLine[1] $Height = $CmdLine[2] $BitsPerPixel = $CmdLine[3] $RefreshRate = $CmdLine[4] ; Change screen resolution _ChangeScreenRes($Width,$Height,$BitsPerPixel,$RefreshRate) ; Alternative method if you don't want to use command-line ;_ChangeScreenRes(1280,800,32,-1) ;=============================================================================== ; ; Function Name: _ChangeScreenRes() ; Description: Changes the current screen geometry, colour and refresh rate. ; Version: 1.0.0.1 ; Parameter(s): $i_Width - Width of the desktop screen in pixels. (horizontal resolution) ; $i_Height - Height of the desktop screen in pixels. (vertical resolution) ; $i_BitsPP - Depth of the desktop screen in bits per pixel. ; $i_RefreshRate - Refresh rate of the desktop screen in hertz. ; Requirement(s): AutoIt Beta > 3.1 ; Return Value(s): On Success - Screen is adjusted, @ERROR = 0 ; On Failure - sets @ERROR = 1 ; Forum(s): http://www.autoitscript.com/forum/index.php?showtopic=20121 ; Author(s): Original code - psandu.ro ; Modifications - PartyPooper ; ;=============================================================================== Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc ;==>_ChangeScreenRes
FN-GM Posted February 9, 2009 Posted February 9, 2009 Here's how to do it using AutoIt. All you need to do is compile the script, create a shortcut to the EXE and than add the desired parameters to the end of the command-line. e.g. ChangeScreenRes.exe 1280 800 32 -1 #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Define variables $Width = $CmdLine[1] $Height = $CmdLine[2] $BitsPerPixel = $CmdLine[3] $RefreshRate = $CmdLine[4] ; Change screen resolution _ChangeScreenRes($Width,$Height,$BitsPerPixel,$RefreshRate) ; Alternative method if you don't want to use command-line ;_ChangeScreenRes(1280,800,32,-1) ;=============================================================================== ; ; Function Name: _ChangeScreenRes() ; Description: Changes the current screen geometry, colour and refresh rate. ; Version: 1.0.0.1 ; Parameter(s): $i_Width - Width of the desktop screen in pixels. (horizontal resolution) ; $i_Height - Height of the desktop screen in pixels. (vertical resolution) ; $i_BitsPP - Depth of the desktop screen in bits per pixel. ; $i_RefreshRate - Refresh rate of the desktop screen in hertz. ; Requirement(s): AutoIt Beta > 3.1 ; Return Value(s): On Success - Screen is adjusted, @ERROR = 0 ; On Failure - sets @ERROR = 1 ; Forum(s): http://www.autoitscript.com/forum/index.php?showtopic=20121 ; Author(s): Original code - psandu.ro ; Modifications - PartyPooper ; ;=============================================================================== Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc ;==>_ChangeScreenRes Isnt it abit of a long way round when you can do it with one line in a batch file?
Arthur Posted February 9, 2009 Posted February 9, 2009 The main reason I like using AutoIt is that you don't have to rely on external programs if you know how to do everything within your script. Also if you are already using AutoIt to create a script to do another task it makes sense to use AutoIt (rather than a batch file) to change the resolution too.
FN-GM Posted February 9, 2009 Posted February 9, 2009 The main reason I like using AutoIt is that you don't have to rely on external programs if you know how to do everything within your script. Also if you are already using AutoIt to create a script to do another task it makes sense to use AutoIt (rather than a batch file) to change the resolution too. Good point. I would have thought you could do this in group policy by now though.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now