Created
June 21, 2024 18:17
-
-
Save jackson5sec/4f983ca5261e0a21cf4b4df8a9d21493 to your computer and use it in GitHub Desktop.
annoying mouse swap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the parameter | |
param ( | |
[string]$side = "L" | |
) | |
# Create an external definition | |
$swapbuttons = @' | |
[DllImport("user32.dll")] | |
public static extern Int32 SwapMouseButton(Int32 swap); | |
'@ | |
# Add class | |
$swapper = Add-Type -MemberDefinition $swapbuttons -Name "swap" -Namespace "user" -PassThru | |
$setting = if ($side -eq "L") {0} else {1} | |
$result = $swapper::SwapMouseButton($setting) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RUNDLL32.EXE user32.dll,SwapMouseButton