Answers:
~LButton::
Send {Ctrl}
return
~LButton UP::
Send {Ctrl}
return
每次单击鼠标(向下和向上)都会Ctrl短暂触发。
正如Paolo指出的那样,您甚至可以在脚本中更改“鼠标”设置:
DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0) ;SPI_SETMOUSESONAR ON
OnExit, ExitSub
ExitSub:
DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0) ;SPI_SETMOUSESONAR OFF
ExitApp
这是RJFalconer回答的一种变体,其中包含Paolo Fulgoni所做的更改。我不想总是在按下CTRL按钮时看到鼠标,我希望DllInfo
修改能够动态地打开和关闭设置,但是我无法使它起作用(脚本将退出)。毫无疑问,AHK中比较老练的人可以解释我做错了什么,但是我继续创建了自己的版本。
当按下鼠标按钮时,它将动态地将“按下控件时显示鼠标”选项打开,然后再将其关闭。在有限的测试中,它可以正常工作,尽管有时鼠标指针会消失。如果有人知道如何修复或有任何其他改进,请随时加入。
它被(过多地)记录在案,因为我很快就忘记了事情,并且当我需要重新访问时,我希望脚本提供足够的信息,而我不需要搜索就可以找到我最初使用的所有旧引用。
;Visualize mouse clicks by showing radiating concentric circles on mouse click
;Author: traycerb
;Date/Version: 01-31-2018
;
;Source:
;/superuser/106815/how-do-you-add-a-visual-effect-to-a-mouse-click-from-within-windows
;https://autohotkey.com/board/topic/77380-mouse-click-special-effects-for-presentationsdemos/
;Dynamically switch on the Windows accessibility feature to show the mouse when the control key is pressed
;when the script is executed, then switch off afterwards
;Windows settings > Mouse > Pointer Options tab > Visibility group > Show location of pointer when I press CTRL key
;Window's SystemParametersInfo function, retrieves or sets the value of one of the
;system-wide parameters. AHK DllCall fxn with SystemParameterInfo parameter is used to access
;this Windows API.
;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
;BOOL WINAPI SystemParametersInfo(
; _In_ UINT uiAction,
; _In_ UINT uiParam,
; _Inout_ PVOID pvParam,
; _In_ UINT fWinIni
;);
;uiParam [in]
;Type: UINT
;
;A parameter whose usage and format depends on the system parameter being queried or set.
;For more information about system-wide parameters, see the uiAction parameter.
;If not otherwise indicated, you must specify zero for this parameter.
;pvParam [in, out]
;Type: PVOID
;
;A parameter whose usage and format depends on the system parameter being queried or set.
;For more information about system-wide parameters, see the uiAction parameter.
;If not otherwise indicated, you must specify NULL for this parameter.
;For information on the PVOID datatype, see Windows Data Types.
;fWinIni [in]
;Type: UINT
;
;If a system parameter is being set, specifies whether the user profile is to be updated,
;and if so, whether the WM_SETTINGCHANGE message is to be broadcast to all top-level
;windows to notify them of the change.
;This parameter can be zero if you do not want to update the user profile
;or broadcast the WM_SETTINGCHANGE message or it can be set to the following [...]
;Accessibility parameter
;S0x101D PI_SETMOUSESONAR
;Turns the Sonar accessibility feature on or off. This feature briefly
;shows several concentric circles around the mouse pointer when the user
;presses and releases the CTRL key.
;The pvParam parameter specifies TRUE for on and FALSE for off.
;Press the control button each time mouse button is pressed, showing location of mouse pointer.
~LButton::
{
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)
Send {Ctrl}
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)
return
}
~RButton::
{
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)
Send {Ctrl}
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)
return
}
#SingleInstance force
行,以避免在双击过程中出现烦人的弹出消息。
~
),使鼠标的正常操作能够通过。我还修改了示例,以便不仅释放鼠标单击,而且最初的鼠标单击都能产生效果。