有没有类似“你写我读”的软件,打一个字读一个字的?

自己写了一个win11微软输入法输入同步朗读的,不同于之前截图ocr的方式,使用的是UIA——无障碍读取方式。
直接读取微软输入法新输入的汉字,然后朗读出来,所以快得多。

和这个小工具同样的原理和使用方法,快捷键ctrl shift n:

你叉叉(You Fa Fa)——输入法关键词屏蔽小工具,也网文作者好帮手~控制骂人情绪,从输入法做起 - 讨论分享 - 小众软件官方论坛 (appinn.net)

用的大神的UIA库 AutoHotkey 使用 UI Automation(UIA) 获取相关信息教程 - 火冷 - 博客园 (cnblogs.com)
autohotkey V2 代码

#include Class_UIA.ah2
#Warn All, Off
#SingleInstance force
global ID
global ifok
ifok := 0
return

~^+n::{
global ID
global ifok
if ifok = 0 {
MouseGetPos , , , &ID, 2
msgbox("已开启朗读模式")
ifok := 1
}else{
msgbox("已关闭朗读模式")
ifok := 0
}
return
}

#HotIf (ifok = 1)

$1:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "1")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}1"
return
}

$space:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "1")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{space}"
return
}

$2:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "2")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}2"
return
}

$3:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "3")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}3"
return
}

$4:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "4")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}4"
return
}

$5:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "5")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}5"
return
}

$6:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "6")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}6"
return
}

$7:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "7")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}7"
return
}

$8:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "8")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}8"
return
}

$9:: {
global ID
local n
try
{
   elWin := UIA.ElementFromHandle(ID)
   cond := UIA.CreatePropertyCondition("name", "9")
   Element := elWin.FindFirst(cond, 4)
   Element := Element.GetNext()
   itemName := Element.GetCurrentPropertyValue(30005)
}
catch
{
itemName :=""
}
run 'mshta vbscript:createobject(`"sapi.spvoice`").speak(`"' itemName '`")(window.close)'
Send "{Raw}9"
return
}

http://dogbean.ysepan.com/
编译了一个exe版本,给需要的人:
图片

使用说明:开启或关闭需要按几下按键,鼠标移动到输入法候选栏,然后按下快捷键 ctrl + shift + n
类似: