Powershell 或其他脚本来交换鼠标按钮?

Jon*_*nas 6 mac mouse windows-7 boot-camp

我想知道这是否可能。我使用运行 Windows 7 的 Macbook……当我没有连接外部鼠标时,我将按钮的左/右设置保留为默认值。但是当我插入鼠标时,我会更改该设置(因为我用左手使用鼠标)。

我想要的是一个简单的 Powershell 脚本,或 Windows 脚本或类似的东西,我可以保留在桌面上并在适当的时间运行。我不一定关心让它自动(当我插入或移除鼠标时)。

Pat*_*our 5

我在 Windows PC 上尝试了这个 PowerShell;我的 BootCamp 上没有 Windows 设置来测试您的确切场景。

它只将我的按钮换成了鼠标。它离开了触摸板和指点杆右手。

[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null

$SwapButtons = Add-Type -MemberDefinition @'
[DllImport("user32.dll")]
public static extern bool SwapMouseButton(bool swap);
'@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru

Write-Host "Mouse buttons currently swapped?" ([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped)

[bool]$returnValue = $SwapButtons::SwapMouseButton(!([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped))

Write-Host "Mouse buttons currently swapped?" ([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped)
Run Code Online (Sandbox Code Playgroud)


Jos*_*h K 0

某些鼠标(Logitech)可以设置为左手使用,而无需更改 Windows 设置。除此之外,我不这么认为。