Windows 实用程序来呈现我在屏幕上按下的键

ric*_*ent 66 windows keyboard-shortcuts on-screen-keyboard

我正在远程培训一大群人,并将涵盖许多应用程序快捷键。

我已经看到MousePose的按键屏幕显示;Windows 有类似的产品吗?

鼠标姿势截图

MousePose 的其他功能(花哨的鼠标指针等)对我来说并不是真的有用,只是按键的 OSD。

Joh*_*n T 38

KeyPosé是适用于 Windows 的MousePosé免费替代品。您可以在截屏视频中看到它的运行情况。

这是一个示例屏幕截图:

替代文字

  • 我认为它有一些问题。您无法更改显示键的位置,有时即使您没有按下某个键,灰色区域也会一直显示,也不会显示 win/super 键。涉及按下两个以上键的组合,例如 ctrl+alt+c,以一种奇怪的方式显示,例如先是 CTRL,然后是 ALT(我想它应该显示 CTRL+ALT),最后是 CTRL+ALT+C。总比没有好,但我认为还有更好的选择。 (5认同)

rbu*_*rte 27

我强烈推荐Carnac The Magnificent。它在 GitHub项目执行得很好,设计得很好并且开源,确实很好地解决了这个问题。

用于演示、截屏和帮助您成为更好的键盘用户的键盘记录和演示实用程序。

截屏

这里有一个可视化鼠标输入的叉子:https : //github.com/bfritscher/carnac/releases

  • @Basj Carnac 比 KeyPosé(只将字母显示为纯文本)更“漂亮”。使用 Carnac,您可以更改显示的键的外观(字体大小、不透明度、颜色)。 (2认同)

Log*_*mon 6

为此,我编写了一个 AutoHotkey_L 脚本。

要运行它,请使用AutoHotkey_L直接 dl),它是 FOSS。此外,使用 AutoHotkey,您可以将脚本编译为 EXE(简单地)。Ahk2Exe.exe /in DisplayPressedKeyOnScreen.ahk/outDisplayPressedKeyOnScreen.exe

它可以在鼠标光标附近显示类似 OSD 的按键或标准工具提示。此外,它还显示鼠标按钮点击和滚轮滚动。

(请注意,框架和模糊是为了说明目的而完成的,脚本本身仅显示没有任何干扰的文本) 截屏

这是脚本(复制并粘贴到记事本,另存为 DisplayPressedKeysOnScreen.ahk):

#NoEnv
#SingleInstance force
#InstallKeybdHook
#MaxHotkeysPerInterval 500

;This work by LogicDaemon is licensed under a Creative Commons Attribution 3.0 Unported License.

Global IdleDelay, LargeDisplay

IdleDelay:=3000

LargeDisplay:=1
; 0 = Tooltip near mouse pointer
; 1 = Big pane at screen bottom

;TrayTip %A_ScriptName%, ????? ?????`, ??????? ?????? ??????? Windows
TrayTip %A_ScriptName%, To Exit`, press the Right Windows logo key.

InputHook := InputHook("BCL1qMV*", "", "")
InputHook.KeyOpt("{All}", "INV")
InputHook.OnKeyDown := Func("OnKeyDown")
InputHook.OnKeyUp := Func("OnKeyUp")
InputHook.OnEnd := Func("RegisterKey")
Loop {
    InputHook.Start()
    InputHook.Wait()
}

return

RWin::
    ExitApp

~*LButton::
~*RButton::
~*MButton::
~*XButton1::
~*XButton2::
    MouseTooltip(SubStr(A_ThisHotkey, 3), 1)
    return

~*LButton Up::
~*RButton Up::
~*MButton Up::
~*XButton1 Up::
~*XButton2 Up::
    MouseTooltip(SubStr(A_ThisHotkey, 3, -3), 0)
    return

~*WheelDown::
~*WheelUp::
~*WheelLeft::
~*WheelRight::
    MouseTooltip(SubStr(A_ThisHotkey, 3), 1)
    MouseTooltip(SubStr(A_ThisHotkey, 3), 0)
    return

MouseTooltip(mbuttons, state){
    RegisterKey(mbuttons, state)
}

TooltipOff:
    If LargeDisplay
        Gui Hide
    Else
        Tooltip
    lastStatesText := {}
    return

OnKeyDown(inputHook, VK, SC) {
    RegisterKey(inputHook, 1, VK, SC)
}

OnKeyUp(inputHook, VK, SC) {
    RegisterKey(inputHook, 0, VK, SC)
}

RegisterKey(inputHook, kstate := 1, VK := 0, SC := 0) {
    local
    global IdleDelay, lastStatesText, inputString
    static keyStates := {}, prevKey, lastPressed, prevState, repeated := 0
         , KeyMappingToName := { (Chr(27)): "Escape"
                               , (Chr(32)): "Space"
                               , (Chr(10)): "Enter" }
         , SkipRepeat := { "LShift": ""
                         , "RShift": ""
                         , "LControl": ""
                         , "RControl": ""
                         , "LAlt": ""
                         , "RAlt": ""
                         , "LWin": ""
                         , "RWin": "" }
         , StringEndKeys := { "{Enter}": ""
                            , "{Escape}": ""
                            , "{Tab}": ""
                            , "{Up}": ""
                            , "{Down}": ""
                            , "{PgUp}": ""
                            , "{PgDn}": "" }
    
    If (VK || SC) {
        singleKey := GetKeyName(Format("vk{:02x}sc{:02x}", VK, SC))
    } Else If (!IsObject(inputHook)) {
        singleKey := inputHook
    }
    textKey := StrLen(singleKey) == 1 ? singleKey : "{" singleKey "}"
    keyStatesText := ""
    For key, state in keyStates
        If (state && key != singleKey)
            keyStatesText .= key "+"
    keyStates[singleKey] := kstate
    If (kstate && lastPressed == textKey && keyStatesText == lastStatesText) {
        If (!SkipRepeat.HasKey(singleKey))
            repeated++
    } Else {
        If (kstate) {
            If (repeated) {
                inputString .= (repeated > 4 || StrLen(lastPressed) > 1) ? "×" . repeated+1 : StrRepeat(lastPressed, repeated)
                , repeated := 0
            }
            If (keyStatesText != lastStatesText || StringEndKeys.HasKey(lastPressed))
                inputString := textKey, lastStatesText := keyStatesText
            Else If (StrLen(inputString) < 15)
                inputString .= textKey
            Else
                inputString := "…" SubStr(inputString, -15) textKey
            lastPressed := textKey
        }
    }
    ShowKeys((lstate ? keyStatesText : lastStatesText) . inputString . (repeated ? ("×" . repeated+1) : (kstate ? "?" : "?")))
    prevKey := singleKey, prevState := kstate
    
    SetTimer TooltipOff, % -IdleDelay
}

ShowKeys(text) {
    global GUIx, GUIy, GUIw, GUIh
         , blkOsdCtrlName, blkOsdCtrlName2
         , MonitorLeft, MonitorRight, MonitorBottom, MonitorTop
    
    If (LargeDisplay) {
        CoordMode Mouse, Screen
        MouseGetPos MouseX, MouseY

        InitLargeDisplay(MouseX, MouseY)
        
        If ((!GUIy) || (MouseX >= MonitorLeft && MouseX <= MonitorRight && MouseY >= GUIy && MouseY <= (GUIy+GUIh)) ) {
            If (MouseY < (MonitorTop + (MonitorBottom - MonitorTop) / 2) )
                GUIy := MonitorBottom - (MonitorBottom - MonitorTop) * 0.2
            Else
                GUIy := MonitorTop + (MonitorBottom - MonitorTop) * 0.2
        }
        
        GuiControl Text, blkOsdCtrlName, %text%
        GuiControl Text, blkOsdCtrlName2, %text%

        Gui, Show, x%GUIx% y%GUIy% NoActivate
    } Else {
        Tooltip % text
    }
}

InitLargeDisplay(MouseX, MouseY) {
    global GUIx, GUIy, GUIw, GUIh
         , blkOsdCtrlName, blkOsdCtrlName2
         , Monitor, MonitorLeft, MonitorRight, MonitorBottom, MonitorTop
    static guiInitialized := False
    ;Initializing GUI / reinitializing after changing monitor
    ;modded func originated from http://www.autohotkey.com/board/topic/8190-osd-function/

    If ( (   MouseX < MonitorLeft
          || MouseX > MonitorRight
          || MouseY < MonitorTop
          || MouseY > MonitorBottom)
        || !guiInitialized) { ; mouse is outside of last screen GUI was positioned at
        ;80 SM_CMONITORS: Number of display monitors on the desktop (not including "non-display pseudo-monitors"). 
        SysGet monCount, 80
        Loop % monCount
        {
            SysGet Monitor, Monitor, %A_Index%
            If (MouseX >= MonitorLeft && MouseX <= MonitorRight && MouseY >= MonitorTop && MouseY <= MonitorBottom) {
                found := true
                break
            }
        }

        If (!found) ; mouse cursor not found on any screen, fallback to default monitor
            SysGet Monitor, Monitor
        
        GUIx := MonitorLeft
        , GUIw := MonitorRight - MonitorLeft
        , GUIh := (MonitorBottom - MonitorTop) * GUIw * 0.00003
        If (GUIh > ((MonitorBottom - MonitorTop) * 0.3))
            GUIh := (MonitorBottom - MonitorTop) * 0.3
        
        opacity:="230"
        , fname:="Tahoma"
        , fsize:=GUIh * 0.65 ; really, pixel = 0.75 point, but with 0.75 lowercase letter with lower part (like "g") will get cut
        , fcolor:="cccccc"
        , bcolor:="222222"
        , fformat:="600"
        
        If (guiInitialized)
            Gui Destroy
        Gui +LastFound +AlwaysOnTop +ToolWindow -Caption
        Gui Margin, 0, 0 ;pixels of space to leave at the left/right and top/bottom sides of the window when auto-positioning.
        Gui Color, ffffff ;changes background color
        Gui Font, s%fsize% w%fformat%, %fname%

        ; 0x80 = SS_NOPREFIX -> Ampersand (&) is shown instead of underline one letter for Alt+letter navigation
        Gui Add, Text, c%bcolor% Center +0x80 w%GUIw% h%GUIh% BackgroundTrans VblkOsdCtrlName, tesT test test
        Gui Add, Text, c%fcolor% Center +0x80 w%GUIw% h%GUIh% BackgroundTrans VblkOsdCtrlName2 xp-3 yp-3 , tesT test test
        
        WinSet ExStyle, +0x20 ; WS_EX_TRANSPARENT -> mouse klickthrough
        WinSet TransColor, ffffff %opacity%

        guiInitialized := True
    }
}

StrRepeat(str, cnt) {
    If (cnt<1)
        return ""
    o := str
    Loop % cnt-1
        o .= str
    return o
}
Run Code Online (Sandbox Code Playgroud)