#Include Class_SQLiteDB.ahk
#Warn
DBFileName := A_ScriptDir . "\词库.DB" ;字符串
DB := SQLiteDB() ;新建db
Sleep(1000)
If !DB.OpenDB(DBFileName)
{
MsgBox("Msg:`t" . DB.ErrorMsg . "`nCode:`t" . DB.ErrorCode, "SQLite Error", 16)
ExitApp
}
Global 碗:="面条"
Global Resulttemp:=""
Global 码:=""
;切换中英文
Shift::
{
Global 碗:=!碗
if(碗)
{
TraySetIcon("中.ico")
}
Else
{
TraySetIcon("英.ico")
}
}
TraySetIcon("中.ico")
#HotIf 碗
;编码
a::
b::
c::
d::
e::
f::
h::
i::
g::
k::
l::
m::
n::
o::
p::
q::
r::
s::
t::
u::
v::
w::
x::
y::
z::
{
Global
CaretGetPos(&x, &y)
码:=码 . A_ThisHotkey
SQL := "SELECT chinese FROM xiaohe where code='" . 码 . "';"
If !DB.GetTable(SQL, &Result)
MsgBox("Msg:`t" . DB.ErrorMsg . "`nCode:`t" . DB.ErrorCode, "SQLite Error", 16)
if(!Result.rows.Has(1)) ;判定值有没有取到
{
ToolTip(码 . "`n" . Resulttemp,x+30,y+50)
}
else ;判定值取到
{
ToolTip(码 . "`n" . Result.Rows[1][1],x+30,y+50)
Resulttemp:=Result.Rows[1][1]
}
}
;上屏
Space::
{
Global
Send Resulttemp
码:=""
ToolTip()
}
;退回修改
BackSpace::
{
Global
CaretGetPos(&x, &y)
码:=SubStr(码,1,-1)
SQL := "SELECT chinese FROM xiaohe where code='" . 码 . "';"
If !DB.GetTable(SQL, &Result)
MsgBox("Msg:`t" . DB.ErrorMsg . "`nCode:`t" . DB.ErrorCode, "SQLite Error", 16)
if(!Result.rows.Has(1)) ;判定值有没有取到
{
ToolTip(码 . "`n" . Resulttemp,x+30,y+50)
}
else ;判定值取到
{
ToolTip(码 . "`n" . Result.Rows[1][1],x+30,y+50)
Resulttemp:=Result.Rows[1][1]
}
}