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?
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.
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?
I like that idea, not got enough brain cells to do it myself, can anyone lead me in the right way
Plus vidres can switch the resolution, run the program you need, then switch it back after.
* 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.
chrbb (5th December 2008)
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...
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
Code:#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Define variables $Width = $CmdLine $Height = $CmdLine $BitsPerPixel = $CmdLine $RefreshRate = $CmdLine ; 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: 188.8.131.52 ; 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;int;byte;int") 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 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 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
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)