Mouse Cursor Scheme Switching

Discussion, questions and support.
Post Reply
mragtronx8
Posts: 58
Joined: Feb 2nd, ’20, 08:36

Post by mragtronx8 » May 25th, ’24, 15:16

hi,
i need ur help please.
I want to create a shortcut / command, to switch/toggle between 2 mouse cursors schemes.
I have 2 cursor schemes "a & b".
Is there a way to change from a to b / b to a with Fastkeys.

Thanx in Advance.
User avatar
Marko
Posts: 1865
Joined: Mar 2nd, ’13, 21:02

Post by Marko » May 25th, ’24, 15:30

mragtronx8
Posts: 58
Joined: Feb 2nd, ’20, 08:36

Post by mragtronx8 » May 25th, ’24, 15:52

hi Marko,
thx for the quick reply.
The link provided didn't help, am getting script error.

Is there a way to execute directly in Fastkeys.
User avatar
Tom
Posts: 893
Joined: Nov 24th, ’15, 23:39

Post by Tom » May 26th, ’24, 20:31

You could do the following: copy the functions into Tools/Startup script:

Code: Select all

SetCursorScheme( Scheme )               { ; By SKAN on D3AO/D3AO @ tiny.cc/setcursorscheme
Local
  Cursors := "Arrow,Help,AppStarting,Wait,Crosshair,IBeam,NWPen,No,SizeNS,"
           . "SizeWE,SizeNWSE,SizeNESW,SizeAll,UpArrow,Hand,Pin,Person"

  SchemePath2 := "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors"
  SchemePath1 := "HKCU\Control Panel\Cursors"
  SetRegView, 64

  If ( Scheme="Windows Default" )
  {
      RegWrite, REG_SZ,    %SchemePath1%,, Windows Default
      RegWrite, REG_DWORD, %SchemePath1%, Scheme Source, 2
      Loop, Parse, Cursors, CSV
      {
          RegRead, Val, %SchemePath2%\Default, %A_LoopField%
          If (! ErrorLevel )
          RegWrite, REG_EXPAND_SZ, %SchemePath1%, %A_LoopField%, %Val%
      }

      SetRegView, Default
      Return DllCall("SystemParametersInfo", "Int",0x57, "Int", 0, "Ptr", 0, "Int", 0)
  }

  SchemeSource := 2
  RegRead, Val, %SchemePath2%\Schemes, %Scheme%

  If ( ErrorLevel )
  {
      SchemeSource := 1
      RegRead, Val, %SchemePath1%\Schemes, %Scheme%
  }

  If ( ErrorLevel )
      SchemeSource := 0,    Scheme := ""

  Cur := StrSplit(Val, ",")
  RegWrite, REG_DWORD, %SchemePath1%, Scheme Source, %SchemeSource%
  RegWrite, REG_SZ, %SchemePath1%,, %Scheme%

  Loop, Parse, Cursors, CSV
  {
      RegRead, Val, %SchemePath2%\Default, %A_LoopField%
      If (! ErrorLevel )
          RegWrite, REG_EXPAND_SZ, %SchemePath1%, %A_LoopField%, % Cur[A_Index]
  }

  SetRegView, Default
Return DllCall("SystemParametersInfo", "Int",0x57, "Int", 0, "Ptr", 0, "Int", 0)
}

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

GetCursorSchemes() {
Local Schemes := ""
  SetRegView, 64
  Loop, Reg
      , HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes, V
   Schemes .= A_LoopRegName . "`n"
  Loop, Reg, HKCU\Control Panel\Cursors\Schemes, V
   Schemes .= A_LoopRegName . "`n"
  SetRegView, Default
Return RTrim(Schemes, "`n")
}
Then create a shortcut (Type: Command) to magnify the cursor:

Code: Select all

SetCursorScheme("Magnified")
...and another shortcut to set the cursor scheme back to default:

Code: Select all

SetCursorScheme("Windows Default") ; Windows 8.1 / 10
; SetCursorScheme("") ; Windows 7 / 8.1 / 10
mragtronx8
Posts: 58
Joined: Feb 2nd, ’20, 08:36

Post by mragtronx8 » May 29th, ’24, 16:20

hi Tom,
thank you for the support.
one more tip please.

My 2 schemes are
1 - Motion
2 - Valley

where in the script should these be replaced;
as default is mentioned a couple times.
Post Reply