Open photkey opened 8 months ago
键盘上的 caps lock 状态灯,不就是指示吗,如果按下亮起,松开灭掉,那就是表明录音成功
caps lock 状态灯 只能确认是否按下capslock
键,无法确认CapsWriter已启动 且当前正在语音输入状态,也无法确认当前输入位置;我觉得capslock状态灯 不能解决这个需求;而且看状态灯 需要低头看。
主要是没有这个状态提示,没有反馈,心里不踏实;如果按下按键就弹出图标提示,会有个即时的反馈,我觉得体验是会更好一些的。
在可见的未来两年内,我无法添加图形提示
@photkey 试试我这个,在tray有图标会不会安心点 https://github.com/HaujetZhao/CapsWriter-Offline/pull/53
自己折腾了一个,虽然效果不完美,但是比没有还是好一些的,这个效果还可以
@photkey 试试我这个,在tray有图标会不会安心点 #53
@H1DDENADM1N 你这个项目挺好的,用起来挺方便,但是对我这个需求帮助不大,一个是看托盘图标还是不够方便,另外一个是对于这个用途来说 跟下图的托盘图标其实效果也差不太多
期待你的GUI 能更新更多功能。
自己折腾了一个,虽然效果不完美,但是比没有还是好一些的,这个效果还可以
哇,这效果不错,代码能发下吗?
哇,这效果不错,代码能发下吗?
#Requires AutoHotkey v2.0
CoordMode("ToolTip", "Screen")
~CapsLock::{
if hwnd := GetCaretPosEx(&x, &y, &w, &h){
; 能够获取到文本光标时,提示信息在光标位置,且x坐标向右偏移5
x := x + 5
}
else{
; 获取不到文本光标时,提示信息在当前窗口的位置
WinGetPos &X, &Y, &W, &H, "A"
x := X + W * 0.25
y := Y + H * 0.7
}
ToolTip("✦语音输入中‧‧‧", x, y) ; 提示信息内容
KeyWait("CapsLock")
ToolTip()
return
}
GetCaretPosEx(&x?, &y?, &w?, &h?) {
x := h := w := h := 0
static iUIAutomation := 0, hOleacc := 0, IID_IAccessible, guiThreadInfo, _ := init()
if !iUIAutomation || ComCall(8, iUIAutomation, "ptr*", eleFocus := ComValue(13, 0), "int") || !eleFocus.Ptr
goto useAccLocation
if !ComCall(16, eleFocus, "int", 10002, "ptr*", valuePattern := ComValue(13, 0), "int") && valuePattern.Ptr
if !ComCall(5, valuePattern, "int*", &isReadOnly := 0) && isReadOnly
return 0
useAccLocation:
; use IAccessible::accLocation
hwndFocus := DllCall("GetGUIThreadInfo", "uint", DllCall("GetWindowThreadProcessId", "ptr", WinExist("A"), "ptr", 0, "uint"), "ptr", guiThreadInfo) && NumGet(guiThreadInfo, A_PtrSize == 8 ? 16 : 12, "ptr") || WinExist()
if hOleacc && !DllCall("Oleacc\AccessibleObjectFromWindow", "ptr", hwndFocus, "uint", 0xFFFFFFF8, "ptr", IID_IAccessible, "ptr*", accCaret := ComValue(13, 0), "int") && accCaret.Ptr {
NumPut("ushort", 3, varChild := Buffer(24, 0))
if !ComCall(22, accCaret, "int*", &x := 0, "int*", &y := 0, "int*", &w := 0, "int*", &h := 0, "ptr", varChild, "int")
return hwndFocus
}
if iUIAutomation && eleFocus {
; use IUIAutomationTextPattern2::GetCaretRange
if ComCall(16, eleFocus, "int", 10024, "ptr*", textPattern2 := ComValue(13, 0), "int") || !textPattern2.Ptr
goto useGetSelection
if ComCall(10, textPattern2, "int*", &isActive := 0, "ptr*", caretTextRange := ComValue(13, 0), "int") || !caretTextRange.Ptr || !isActive
goto useGetSelection
if !ComCall(10, caretTextRange, "ptr*", &rects := 0, "int") && rects && (rects := ComValue(0x2005, rects, 1)).MaxIndex() >= 3 {
x := rects[0], y := rects[1], w := rects[2], h := rects[3]
return hwndFocus
}
useGetSelection:
; use IUIAutomationTextPattern::GetSelection
if textPattern2.Ptr
textPattern := textPattern2
else if ComCall(16, eleFocus, "int", 10014, "ptr*", textPattern := ComValue(13, 0), "int") || !textPattern.Ptr
goto useGUITHREADINFO
if ComCall(5, textPattern, "ptr*", selectionRangeArray := ComValue(13, 0), "int") || !selectionRangeArray.Ptr
goto useGUITHREADINFO
if ComCall(3, selectionRangeArray, "int*", &length := 0, "int") || length <= 0
goto useGUITHREADINFO
if ComCall(4, selectionRangeArray, "int", 0, "ptr*", selectionRange := ComValue(13, 0), "int") || !selectionRange.Ptr
goto useGUITHREADINFO
if ComCall(10, selectionRange, "ptr*", &rects := 0, "int") || !rects
goto useGUITHREADINFO
rects := ComValue(0x2005, rects, 1)
if rects.MaxIndex() < 3 {
if ComCall(6, selectionRange, "int", 0, "int") || ComCall(10, selectionRange, "ptr*", &rects := 0, "int") || !rects
goto useGUITHREADINFO
rects := ComValue(0x2005, rects, 1)
if rects.MaxIndex() < 3
goto useGUITHREADINFO
}
x := rects[0], y := rects[1], w := rects[2], h := rects[3]
return hwndFocus
}
useGUITHREADINFO:
if hwndCaret := NumGet(guiThreadInfo, A_PtrSize == 8 ? 48 : 28, "ptr") {
if DllCall("GetWindowRect", "ptr", hwndCaret, "ptr", clientRect := Buffer(16)) {
w := NumGet(guiThreadInfo, 64, "int") - NumGet(guiThreadInfo, 56, "int")
h := NumGet(guiThreadInfo, 68, "int") - NumGet(guiThreadInfo, 60, "int")
DllCall("ClientToScreen", "ptr", hwndCaret, "ptr", guiThreadInfo.Ptr + 56)
x := NumGet(guiThreadInfo, 56, "int")
y := NumGet(guiThreadInfo, 60, "int")
return hwndCaret
}
}
return 0
static init() {
try
iUIAutomation := ComObject("{E22AD333-B25F-460C-83D0-0581107395C9}", "{30CBE57D-D9D0-452A-AB13-7AC5AC4825EE}")
hOleacc := DllCall("LoadLibraryW", "str", "Oleacc.dll", "ptr")
NumPut("int64", 0x11CF3C3D618736E0, "int64", 0x719B3800AA000C81, IID_IAccessible := Buffer(16))
guiThreadInfo := Buffer(A_PtrSize == 8 ? 72 : 48), NumPut("uint", guiThreadInfo.Size, guiThreadInfo)
}
}
需要安装:autohotkey V2
需要安装:autohotkey V2
感谢,用上了,发现新天地呀
需要安装:autohotkey V2
我把它封装exe并加到GUI里了,跟随start_client_gui.exe
一起启动停止,美滋滋🥰
需要安装:autohotkey V2
我把它封装exe并加到GUI里了,跟随
start_client_gui.exe
一起启动停止,美滋滋🥰
好像有个BUG,运行start.exe
的时候hint_while_recording.exe
并不会自动启停,要单独运行start_client_gui.exe
才行。
好像有个BUG,运行
start.exe
的时候hint_while_recording.exe
并不会自动启停,要单独运行start_client_gui.exe
才行。
就是这样设计的,start.exe
调用的start.py
就没写启停hint_while_recording.exe
相关功能的代码😂。
另转录功能相关的代码也是只有start_client_gui.exe
才有哈。
这里有提到 服务端、客户端分离 的原因。start.exe
也不会再更新加入更多功能。
不过如果有需要你可以自己修改下start.py
,把相关代码段抄过去。
现在已经利用nssm设置了开机自启动+隐藏cmd窗口,在输入的时候有些不踏实,所以希望能够加入输入状态提示;
按下启动热键 开始语音识别时,获取
当前光标位置
,并在该位置 显示一个gif图片,这样更加有确认感: