AutoHotkey是最简单的解决方案。我花了一些时间为键盘找到正确的映射,我认为这是共享它的好地方。(感谢Ilan显示CTRL和SHIFT组合。)
我的Dell Precision 7510笔记本电脑没有专用的“开始”和“结束”按钮,但有专用的PrtScr和“插入”按钮(如下所示)。因为我通常使用外部键盘,并且经常使用“打印屏幕”键,所以我需要一种在使用笔记本电脑键盘时在“ 打印屏幕”和“ 主页”之间切换该按钮的方法。基于Iian的示例,我设置了Win + Print Screen来切换覆盖。
; My Dell Precision 7510 laptop does not have dedicated Home and End buttons
; but it does have dedicated PrtScr and Insert buttons.
; This script will override those buttons as Home and End.
; Idea from: http://superuser.com/questions/412761/mini-keyboard-has-no-home-end-keys-how-to-type-them
; Use the Win+Printscreen key to toggle these hotkeys. They are only needed when using the laptop keyboard.
; Note that this script should be loaded after Snagit or other software that overrides the Print Screen key or those programs may fail to map properly.
#Printscreen::
T:=!T
if(T) ; If it's on
{
;--- Map the Printscreen and Insert keys ---
Hotkey, Printscreen, Printscreen, On
Hotkey, Insert, Insert, On
SoundBeep 423, 100
SoundBeep 423, 150
ToolTip, Laptop PrtScr/Insert remapped to Home/End...
Sleep, 1500
ToolTip
;=== Home ===
; Note that MsgBox, ToolTip, and SoundBeep lines are not executing after the first key is mapped. Hmm. BS 7/27/2016
; Home = start of line
Printscreen::Send {Home}
; Ctrl-Home = start of document
^Printscreen::Send {LCtrl down}{Home}{LCtrl up}
; Shift-Home = select to start of line
+Printscreen::Send {LShift down}{Home}{LShift up}
; Ctrl-Shift-Home = select to start of document
^+Printscreen::Send {LCtrl down}{LShift down}{Home}{LShift up}{LCtrl up}
;=== End ===
; End = end of line
Insert::Send {End}
; Ctrl-End = end of document
^Insert::Send {LCtrl down}{End}{LCtrl up}
; Shift-End = select to end of line
+Insert::Send {LShift down}{End}{LShift up}
; Ctrl-Shift-End = select to start of document
^+Insert::Send {LCtrl down}{LShift down}{End}{LShift up}{LCtrl up}
}
else
{
;--- Disable the Printscreen and Insert key mapping ---
Hotkey, Printscreen, Off
Hotkey, Insert, Off
SoundBeep 303, 150
ToolTip, Laptop PrtScr/Insert remapping disabled...
Sleep, 1500
ToolTip
}
Return