之前发过一个 但是脚本丢了 ,正好有个粉丝需要 就花了点时间 搞了一下。
之前的写法完全忘记了 o(╥﹏╥)o 只好重新开始 ,不过应该是优化了写法(印象中之前用的是个笨方法)
这次用上了ASCII码 并对特殊符号进行了分析。不多说 代码很易读。
(不知道这是 lua 还是 vb 所以我就随便传了 下 大家将就看 复制到 脚本精灵就好了)
//读取txt word = Plugin.File.ReadFileEx("D: 071.txt") //TracePrint word mydelay = 20 //等待2s 将鼠标放到定义位置 Delay 2000 TracePrint Asc("`") TracePrint Asc("'") For i = 0 To len(word) //大写字母 If (Asc(Mid(word, i, 1))>=65 And Asc(Mid(word, i, 1)) <= 90) Then input_ua(Mid(word, i, 1)) //小写字母 ElseIf (Asc(Mid(word, i, 1)) >= 97 And Asc(Mid(word, i, 1)) <= 122) Or (Asc(Mid(word, i, 1)) >= 44 And Asc(Mid(word, i, 1)) <= 57) Or (Asc(Mid(word, i, 1)) = 39) Or (Asc(Mid(word, i, 1)) = 59) Or (Asc(Mid(word, i, 1)) = 61) Or (Asc(Mid(word, i, 1)) = 96) Or (Asc(Mid(word, i, 1)) >= 91 And Asc(Mid(word, i, 1)) <= 93) Then input_sa(Mid(word, i, 1)) Else symbols(Asc(Mid(word, i, 1))) End If Next Function symbols(num) If num = 32 Then KeyDown "Space", 1 Delay mydelay KeyUp "Space", 1 ElseIf num = 33 Then KeyDown "Shift", 1 KeyDown "1", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "1", 1 ElseIf num = 34 Then KeyDown "Shift", 1 KeyDown "'", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "'", 1 ElseIf num = 35 Then KeyDown "Shift", 1 KeyDown "3", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "3", 1 ElseIf num = 36 Then KeyDown "Shift", 1 KeyDown "4", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "4", 1 ElseIf num = 37 Then KeyDown "Shift", 1 KeyDown "5", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "5", 1 ElseIf num = 38 Then KeyDown "Shift", 1 KeyDown "7", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "7", 1 ElseIf num = 40 Then KeyDown "Shift", 1 KeyDown "9", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "9", 1 ElseIf num = 41 Then KeyDown "Shift", 1 KeyDown "0", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "0", 1 ElseIf num = 42 Then KeyDown "Shift", 1 KeyDown "8", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "8", 1 ElseIf num = 43 Then KeyDown "Shift", 1 KeyDown "=", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "=", 1 ElseIf num = 58 Then KeyDown "Shift", 1 KeyDown ";", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp ";", 1 ElseIf num = 60 Then KeyDown "Shift", 1 KeyDown ",", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp ",", 1 ElseIf num = 62 Then KeyDown "Shift", 1 KeyDown ".", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp ".", 1 ElseIf num = 63 Then KeyDown "Shift", 1 KeyDown "/", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "/", 1 ElseIf num = 64 Then KeyDown "Shift", 1 KeyDown "2", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "2", 1 ElseIf num = 94 Then KeyDown "Shift", 1 KeyDown "6", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "6", 1 ElseIf num = 95 Then KeyDown "Shift", 1 KeyDown "-", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "-", 1 ElseIf num = 126 Then KeyDown "Shift", 1 KeyDown "`", 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp "`", 1 End If End Function //小写输入 Function input_sa(str) KeyDown str, 1 Delay mydelay KeyUp str, 1 End Function //大写输入 Function input_ua(str) KeyDown "Shift", 1 KeyDown str, 1 Delay mydelay KeyUp "Shift", 1 Delay mydelay KeyUp str, 1 End Function //定义一个函数,可以在脚本中调用这个函数,支持参数和返回值 //返回值 = Lib.算法.中文汉字转拼音