=""){ Loop, Read, C:\Users\Administrator\Desktop\test.txt { if (tcmatch(A_LoopReadLine,ma)) out.=A_LoopReadLine . "rn" }
tc群友问如何调用tcmatch实现首字母简拼搜索
写了这个示例,自备dll文件
; Generated by Auto-GUI 3.0.1
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
dllPath:="C:\AHK\Lib\tcmatch\tcmatch.dll"
out:=""
; FileDelete, C:\Users\Administrator\Desktop\test.txt ; 删除文件内容,如果文件不存在则忽略此步骤
; FileAppend, %test%, C:\Users\Administrator\Desktop\test.txt ; 将变量内容写入文件
FileRead, fileData, C:\Users\Administrator\Desktop\test.txt
Gui Font, s9, Segoe UI
Gui Add, Edit, h40 w300 gmatch vma,
Gui Add, Edit, h300 w300 gsubmit vfileData,%fileData%
Gui Show,,中文模糊搜索
Return
submit:
gui,Submit,NoHide
FileDelete, C:\Users\Administrator\Desktop\test.txt
FileAppend, %fileData%, C:\Users\Administrator\Desktop\test.txt
return
match:
out:=""
ToolTip
gui,Submit,NoHide
if (ma!=""){
Loop, Read, C:\Users\Administrator\Desktop\test.txt
{
if (tcmatch(A_LoopReadLine,ma))
out.=A_LoopReadLine . "`r`n"
}
}else
ToolTip
ToolTip,%out%
return
GuiEscape:
GuiClose:
ExitApp
TCMatchOn(dllPath = "") {
if(g_TCMatchModule)
return g_TCMatchModule
g_TCMatchModule := DllCall("LoadLibrary", "Str", dllPath, "Ptr")
return g_TCMatchModule
}
TCMatchOff() {
DllCall("FreeLibrary", "Ptr", g_TCMatchModule)
g_TCMatchModule := ""
}
TCMatch(aHaystack, aNeedle) {
static MatchFileW, g_TCMatchModule
MatchFileW := (A_PtrSize == 8 ) ? "TCMatch64\MatchFileW" : "TCMatch\MatchFileW"
SplitPath A_AhkPath,, OutDir
dllPath := OutDir "\Lib\tcmatch\" ((A_PtrSize == 8 ) ? "TCMatch64" : "TCMatch") ".dll"
g_TCMatchModule := TCMatchOn(dllPath)
Return DllCall(MatchFileW, "WStr", aNeedle, "WStr", aHaystack)
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


