按键精灵_ 成语接龙『回文模式』,
词源为百度
按键精灵_ 成语接龙『回文模式』,
词源为百度
按键精灵_ 成语接龙『回文模式』,词源为百度
import "xin.lua" import "file.lua" dim url1,s,huici,path,xinxin,strsize,str1,str2,str3,desk,path1,i,pat,recorded,chengyutiqu,fir,fileyn,pathyn,jj,yongguode, _ yongguofou,path2,chengyu pathyn= "/sdcard/achengyu/" fileyn=dir.Exist (pathyn) if fileyn=0 then dir.create(pathyn) end if path = "/sdcard/achengyu/daitiqu" path1 = "/sdcard/achengyu/yitiqu" path2 = "/sdcard/achengyu/yongguode" '循环次数xinxin xinxin=0 '是否执行回文模式 huici=1 While true desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If fir = Sys.GetClipText() fir=rtrim(fir) fir=UTF8.Right(fir,4) If UTF8.Len(fir) <> 4 Then sm("剪贴板字符长度有误,脚本停止") EndScript End If fir=UTF8.Mid(fir,4,1) url1="m.baidu.com/s?from=1086k&word="&fir&"开头的成语" s = URL.Get(url1) desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If file.write path, s str1=file.Read(path) str2 = Mid(str1, 41000, 50000) str3=xin.extractChinese(str2) file.write path1, str3 //汉字提取出来了,现在开始提取天开头的四字成语 i = 0 recorded="" chengyu="" while true i = UTF8.InStr(i+1, str3, fir) if i = 0 then exit while End If desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If //提取出来,并进行一些关键词过滤,使得不会出现错误的成语 chengyu=UTF8.Mid(str3,i,4) chengyu=过滤1(chengyu) chengyu=过滤2(chengyu) chengyu=过滤3(chengyu) chengyu=过滤4(chengyu) chengyu = 过滤5(chengyu) recorded=recorded&chengyu wend //recorded中包含提取出来的【天】开头的四字成语 //从第一个发送,并记录为已发送,继续接龙下一个成语 jj=1 For 10 chengyutiqu = UTF8.Mid(recorded, jj, 4) //如果在已使用的文本中没有找到该词语那么跳出循环 yongguode=file.Read(path2) yongguofou=UTF8.InStr(jj,yongguode,chengyutiqu) If yongguofou = 0 Then Exit For End If If jj>39 Then EndScript End If jj=jj+4 Next file.Append(path2,chengyutiqu) Sys.SetClipText chengyutiqu pat = Sys.GetClipText() qq发送消息(pat) fir=UTF8.Mid(pat,4,1) Wend Sub sm(s) ShowMessage s Delay 2000 End Sub sub qq发送消息(sss) Dim t,str11 t=500 if huici=1 then str11=huiw(sss) sss=sss&" "&str11 end if inputtext sss delay t keypress "enter" delay 2000 desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If If xinxin=1 Then endscript End If end sub function 过滤1(s) dim SpecialCharacter,sc,scamount,PatternMatchingCharacter,Char,i i=1 SpecialCharacter=" 【 1234567890 _.,—.→-;》,』,●、。(:”), 】"&" "&" "&" " sc=SpecialCharacter scamount=UTF8.Len(sc) for scamount Char=UTF8.Mid(sc,i,1) PatternMatchingCharacter=UTF8.InStr(1,s,Char) if PatternMatchingCharacter>0 then s="" exit for end if i=i+1 next 过滤1=s end function function 过滤2(s) dim SpecialCharacter,sc,scamount,PatternMatchingCharacter,Char,i i=1 SpecialCharacter="瞚褵矣缰哨汹或状聋肓榭阙箓谎唳澎续髓湃屑" sc=SpecialCharacter scamount=UTF8.Len(sc) for scamount Char=UTF8.Mid(sc,i,1) PatternMatchingCharacter=UTF8.InStr(4,s,Char) if PatternMatchingCharacter>0 then s="" exit for end if i=i+1 next 过滤2=s end function function 过滤3(s) dim SpecialCharacter,sc,scamount,PatternMatchingCharacter,Char,i i=1 SpecialCharacter="稀罕东西秘密行动动员拔山来抱佛脚习事物名习惯成自定时炸弹私宅拥有私宅的拥动脑筋的的容貌体体态的词可对人言言信使往往还信而而行信口貌或体态际遇的人类名称的的近义词有一对反有两对反有两对近有一对近动的成语有两个动步而行信秘密的人秘的行动秘密的行迹螳螂捕动物名称风扫落叶唳华亭鹤西分文不雨后春笋为国捐躯为虎作伥清香鲜嫩稀少的词稀罕的东稀少的成晓行夜住住这些成书籍名称然的变化处之绰然色彩成语语言的成晓理方面忍无可忍物神态的的语言的的容貌或来自历史史故事类" sc=SpecialCharacter scamount=UTF8.Len(sc) for scamount Char=UTF8.Mid(sc,i,4) if Char=s then s="" exit for end if i=i+4 next 过滤3=s end function function 过滤4(s) dim SpecialCharacter,sc,scamount,PatternMatchingCharacter,Char,i,MyString,MyStringNum i = 1 SpecialCharacter = "的,ú,à,à,í,“,ǎ,成语,不成,开头,结尾,怎么,评价,字谐音,字开头,字打头,加载中,…" MyString = Split(SpecialCharacter,",") MyStringNum=UBound(MyString)+1 i=0 for MyStringNum Char=UTF8.InStr(1,s,MyString(i)) if Char>0 then s="" exit for end if i=i+1 next 过滤4=s end function function 过滤5(s) dim SpecialCharacter,sc,scamount,PatternMatchingCharacter,Char,i i=1 SpecialCharacter="丈八蛇矛上漏下湿及锋而试绰约多姿发硎新试公报私仇绰约多姿象牙之塔" sc=SpecialCharacter scamount=UTF8.Len(sc) for scamount Char=UTF8.Mid(sc,i,4) if Char=s then s="" exit for end if i=i+4 next 过滤5=s end function function huiw(回文) dim url1,s,path,strsize,str1,str2,str3,desk,path1,i,pat,recorded,chengyutiqu,fir,jj,yongguode, _ yongguofou,path2,chengyu path = "/sdcard/achengyu/daitiquhw" path1 = "/sdcard/achengyu/yitiquhw" path2 = "/sdcard/achengyu/yongguodehw" desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If fir =UTF8.Mid(回文,1,1) url1="m.baidu.com/s?from=1086k&word="&fir&"结尾的成语" s = URL.Get(url1) desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If file.write path, s str1=file.Read(path) str2 = Mid(str1, 41000, 50000) str3=xin.extractChinese(str2) file.write path1, str3 //汉字提取出来了,现在开始提取天开头的四字成语 i = 0 recorded="" chengyu="" while true i = UTF8.InStr(i+4, str3, fir) if i = 0 then exit while End If desk=CmpColor(168,159,"7B522A|00FF00-101010",0.9) If desk>-1 Then endscript End If //提取出来,并进行一些关键词过滤,使得不会出现错误的成语 chengyu=UTF8.Mid(str3,i+1,4) chengyu=过滤1(chengyu) chengyu=过滤2(chengyu) chengyu=过滤3(chengyu) chengyu=过滤4(chengyu) chengyu = 过滤5(chengyu) recorded=recorded&chengyu wend //recorded中包含提取出来的【天】结尾的四字成语 //从第一个发送,并记录为已发送,继续接龙下一个成语 jj=1 For 10 chengyutiqu = UTF8.Mid(recorded, jj, 4) //如果在已使用的文本中没有找到该词语那么跳出循环 yongguode=file.Read(path2) yongguofou=UTF8.InStr(jj,yongguode,chengyutiqu) If yongguofou = 0 Then Exit For End If If jj>39 Then EndScript End If jj=jj+4 Next file.Append(path2,chengyutiqu) huiw=chengyutiqu end function
xin.lua
--~ 提取中文,存为数组 --~ 提取中文,存为数组 function QMPlugin.extractChinese(s) local t = {} pcall(function() k=1 for v in string.gmatch(s,"[\128-\254]+") do t[k]=v k=k+1 end end) t=table.concat(t) return t end