Option explicit ' Set the mouse speed based on param. ' Param is 'Wireless' or 'cordless' for decreased sensitivity. ' Param is 'wired' or 'usb' for normal sensitivity. ' I use either a Logitech wireless/cordless mouse with a USB dongle, or ' a USB wired Dell/MS mouse. The Logitech is *way* more sensitive than the ' wired mouse. This script will change the mouse control panel setting ' to make either more-or-less the same sensitivity. ' ---------------------------------------------------------------------------- ' -- $Id: //guest/paul_m_thompson/gd.src/vbs/mouse.vbs#3 $ ' -- $Change: 8139 $ ' -- $DateTime: 2012/06/09 07:02:05 $ ' -- $Author: paul_m_thompson $ ' ---------------------------------------------------------------------------- ' Sometimes have to fiddle with these to get the timing right. ' they're very machine-dependent Const SHORT_SLEEP = 100 Const MEDIUM_SLEEP = 1000 Const LONG_SLEEP = 5000 Const MOUSE_CONTROL_PANEL = "control main.cpl @0,2" Const MOUSE_CONTROL_PANEL_NAME = "Mouse Properties" ' Current mouse sensitivity is in the registry at: ' [HKEY_USERS\SID\Control Panel\Mouse\MouseSensitivity="16" ' e.g. ' [HKEY_USERS\S-1-1-11-1111101111-1100010100-1001010010-0101\Control Panel\Mouse\MouseSensitivity="16" ' Attempting to change mouse sensitivity by setting this value directly ' WILL NOT WORK! Mouse Control Panel MUST be used! ' Set mouse sensitivity using the Mouse Control Panel and VbScript PUSHKEYS ' Open Mouse Control Panel to tab # 2 (Pointer Options). By default ' the "Select Pointer Speed" (ALT-C) slider control will be selected. ' C:\Windows\system32\main.cpl @0,2 ' if that doesn't work, try "control main.cpl @0,2" or "rundll32.exe shell32.dll,Control_RunDLL main.cpl @0,2" ' see ( http://support.microsoft.com/kb/192806 ) ' HOME or END moves the slider to left/minimum or right/maximum. LEFT or RIGHT moves slider one notch. ' Speed settings are 1,2,4,6 ... 20 (11 possible settings) ' %A == ALT-A == Apply ' value from 1 (least sensitive) to 20 (most sensitive) const MOUSE_PAD_SPEED = 18 const MOUSE_USB_SPEED = 18 const MOUSE_WIRELESS_SPEED = 6 ' For command line params dim objArgs , strKeys set objArgs = WScript.Arguments ' For I = 0 to objArgs.Count - 1 ' WScript.Echo "DEBUG : arg " & CStr(I) & " == " & objArgs(I) ' Next ' Must have at least 1 param to do anything. ' If param handled, move mouse speed slider and hit APPLY. ' Mouse slid If lcase(objArgs(0))="wireless" or lcase(objArgs(0))="cordless" then strKeys = "{HOME}{RIGHT " & MOUSE_WIRELESS_SPEED \ 2 & "}%A" elseif lcase(objArgs(0))="wired" or lcase(objArgs(0))="usb" then strKeys = "{HOME}{RIGHT " & MOUSE_USB_SPEED \ 2 & "}%A" elseif lcase(objArgs(0))="pad" then strKeys = "{HOME}{RIGHT " & MOUSE_PAD_SPEED \ 2 & "}%A" else Wscript.Echo "Param is 'wireless'|'cordless' for wireless mouse, 'wired'|'usb' for USB mouse| 'pad' for pad" WScript.Quit(1) end if ' Wscript.Echo "Create wscript.shell object" Dim wsh Set wsh = WScript.CreateObject("WScript.Shell") ' Wscript.Echo "run the control panel" wsh.Run MOUSE_CONTROL_PANEL ' It can take a while for Windows to do things..... WScript.Sleep LONG_SLEEP ' Make sure the mouse control panel is activated before we start "pushing" keys. 'Wscript.Echo "activate the control panel" wsh.AppActivate MOUSE_CONTROL_PANEL_NAME wsh.SendKeys strKeys ' Close panel and get outta here. WScript.Sleep MEDIUM_SLEEP wsh.AppActivate MOUSE_CONTROL_PANEL_NAME wsh.SendKeys "%{F4}"