; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: Farhan Ahmad ; ; Script Function: ; Swaps the mouse cursor schemes between the given one and "Windows Default." ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. ; Windows Aero scheme is a system scheme in Windows Vista and will be defined ; as a user scheme in other versions. if (A_OSVersion = "WIN_VISTA") { SwapCursors("Windows Aero", 2) } else { SwapCursors("Windows Aero", 1) } ; Function Name: ; SwapCursors ; ; Description: ; This function swaps the mouse cursors schemes between the Windows Default ; and the given scheme. ; ; Parameters: ; schemeName - Name of the other scheme. ; schemeSource - Type of the scheme. ; 0 - None Windows Default (Probably not going to be used) ; 1 - User Scheme ; 2 - System Scheme ; SwapCursors(schemeName, schemeSource) { CursorKeyNames = Arrow,Help,AppStarting,Wait,Crosshair,IBeam,NWPen,No,SizeNS,SizeWE,SizeNWSE,SizeNESW,SizeAll,UpArrow,Hand RegRead currentScheme, HKEY_CURRENT_USER, Control Panel\Cursors if (currentScheme = schemeName) { schemeName = Windows Default schemeSource = 0 } ; Figure out the key that the scheme is saved at. If (schemeSource = 0) { ; Windows default registryKey = SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes registryRoot = HKEY_LOCAL_MACHINE } else if (schemeSource = 1) { ; User scheme registryKey = Control Panel\Cursors\Schemes registryRoot = HKEY_CURRENT_USER } else if (schemeSource = 2) { ; System scheme registryKey = SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes registryRoot = HKEY_LOCAL_MACHINE } else { MsgBox Invalid scheme type exit } ;MsgBox %registryKey% %registryRoot% %schemeName% %schemeSource% ; Read the scheme RegRead schemeToUse, %registryRoot%, %registryKey%, %schemeName% ; Write out the basic info about the new scheme if (schemeName = "Windows Default") { RegWrite REG_SZ, HKEY_CURRENT_USER, Control Panel\Cursors, , } else { RegWrite REG_SZ, HKEY_CURRENT_USER, Control Panel\Cursors, , %schemeName% } RegWrite REG_DWORD, HKEY_CURRENT_USER, Control Panel\Cursors, Scheme Source, %schemeSource% ; Remove any double quotes from the scheme StringReplace schemeToUse, schemeToUse, `", , All ; Replace the keys. StringSplit schemeCursors, schemeToUse, `, Loop, Parse, CursorKeyNames, `, { RegWrite REG_EXPAND_SZ, HKEY_CURRENT_USER, Control Panel\Cursors, %A_LoopField%, % schemeCursors%A_Index% } ; Load the new cursors SPI_SETCURSORS := 0x57 result := DllCall("SystemParametersInfo", "UInt", SPI_SETCURSORS, "UInt", 0, "UInt", 0, "UInt", 0) ;MsgBox Error Level: %ErrorLevel% `nLast error: %A_LastError%`nresult: %result% }